Package io.deephaven.base.cache
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 TypeMethodDescriptionboolean
equals
(INPUT_TYPE inputItem, @NotNull Object cachedItem) Note: equals(inputItem, cachedItem) implies hashCode(inputItem) == cachedItem.hashCode() must be true.int
hashCode
(INPUT_TYPE inputItem) makeCacheableItem
(INPUT_TYPE inputItem) Note: The following must be true: hashCode(inputItem) == outputItem.hashCode() && equals(inputItem, outputItem)
-
Method Details
-
equals
Note: equals(inputItem, cachedItem) implies hashCode(inputItem) == cachedItem.hashCode() must be true.- Parameters:
inputItem
- The input itemcachedItem
- The cached item- Returns:
- True if inputItem is equal to cachedItem for the cache's purposes.
-
hashCode
- Parameters:
inputItem
- The input item- Returns:
- Return a hash code for inputItem consistent with its cacheable form.
-
makeCacheableItem
Note: The following must be true: hashCode(inputItem) == outputItem.hashCode() && equals(inputItem, outputItem)- Parameters:
inputItem
- The input item- Returns:
- A cacheable version of inputItem.
-