Interface StringCache<STRING_LIKE_TYPE extends CharSequence>

All Known Implementing Classes:
AlwaysCreateStringCache, ConcurrentBoundedStringCache, ConcurrentUnboundedStringCache, OpenAddressedWeakUnboundedStringCache

public interface StringCache<STRING_LIKE_TYPE extends CharSequence>
Generic caching interface for Strings and String-like CharSequences.
  • Field Details

  • Method Details

    • capacity

      int capacity()
      Get a hint about this cache's capacity and behavior.
      Returns:
      -1 : This is an unbounded cache. 0 : This "cache" doesn't actually perform any caching. >0 : Actual capacity bound.
    • getType

      @NotNull @NotNull Class<STRING_LIKE_TYPE> getType()
      Returns:
      The type of the elements in this cache.
    • getEmptyString

      @NotNull STRING_LIKE_TYPE getEmptyString()
      Returns:
      A cached STRING_LIKE_TYPE that represents the empty string.
    • getCachedString

      @NotNull STRING_LIKE_TYPE getCachedString(@NotNull @NotNull StringCompatible protoString)
      Parameters:
      protoString - The string-like CharSequence to look up
      Returns:
      A cached STRING_LIKE_TYPE that corresponds to the current value of the CharSequence expressed by protoString
    • getCachedString

      @NotNull STRING_LIKE_TYPE getCachedString(@NotNull @NotNull String string)
      Parameters:
      string - The String to look up
      Returns:
      A cached STRING_LIKE_TYPE that corresponds to the CharSequence expressed by string
    • getCachedString

      @NotNull default STRING_LIKE_TYPE getCachedString(@NotNull @NotNull CharSequence charSequence)
      Convenience method to allow arbitrary CharSequence references to be used in lookup.
      Parameters:
      charSequence - The CharSequence to look up
      Returns:
      A cached STRING_LIKE_TYPE that corresponds to charSequence