Interface OpenAddressedCanonicalizationCache.Adapter<INPUT_TYPE,OUTPUT_TYPE>

Type Parameters:
INPUT_TYPE -
OUTPUT_TYPE -
Enclosing class:
OpenAddressedCanonicalizationCache

public static interface OpenAddressedCanonicalizationCache.Adapter<INPUT_TYPE,OUTPUT_TYPE>
Allows cache users to supercede the equals() and hashCode() methods of their input items, and supply an alternative object to cache.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    equals(INPUT_TYPE inputItem, @NotNull Object cachedItem)
    Note: equals(inputItem, cachedItem) implies hashCode(inputItem) == cachedItem.hashCode() must be true.
    int
    hashCode(INPUT_TYPE inputItem)
     
    Note: The following must be true: hashCode(inputItem) == outputItem.hashCode() && equals(inputItem, outputItem)
  • Method Details

    • equals

      boolean equals(@NotNull INPUT_TYPE inputItem, @NotNull @NotNull Object cachedItem)
      Note: equals(inputItem, cachedItem) implies hashCode(inputItem) == cachedItem.hashCode() must be true.
      Parameters:
      inputItem - The input item
      cachedItem - The cached item
      Returns:
      True if inputItem is equal to cachedItem for the cache's purposes.
    • hashCode

      int hashCode(@NotNull INPUT_TYPE inputItem)
      Parameters:
      inputItem - The input item
      Returns:
      Return a hash code for inputItem consistent with its cacheable form.
    • makeCacheableItem

      OUTPUT_TYPE makeCacheableItem(@NotNull INPUT_TYPE inputItem)
      Note: The following must be true: hashCode(inputItem) == outputItem.hashCode() && equals(inputItem, outputItem)
      Parameters:
      inputItem - The input item
      Returns:
      A cacheable version of inputItem.