public class HashCacheWrapper<T>
extends java.lang.Object
Usage of this class is only making sense if the hash values of the underlying objects don't change, but that is true when depending on hashes anyway. Caching the hash is best if its calculation is expensive or the costs are unknown.
Constructor and Description |
---|
HashCacheWrapper(T wrapped)
Constructor.
|
HashCacheWrapper(T wrapped,
HashCodeCalculator<? super T> hashCodeCalculator,
UniformMatcher<? super T> matcher)
Constructor.
|
HashCacheWrapper(T wrapped,
int hashCodeValue,
UniformMatcher<? super T> matcher)
Constructor.
|
HashCacheWrapper(T wrapped,
UniformMatcher<? super T> matcher)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object o) |
T |
getWrapped()
Get the wrapped object.
|
int |
hashCode() |
public HashCacheWrapper(T wrapped, int hashCodeValue, @Nullable UniformMatcher<? super T> matcher)
wrapped
- wrapped objecthashCodeValue
- hash value to usematcher
- matcher to use for equality checks, if null
Match.DEFAULT_MATCHER
will be usedpublic HashCacheWrapper(@NotNull T wrapped)
wrapped
- wrapped objectpublic HashCacheWrapper(@NotNull T wrapped, @Nullable UniformMatcher<? super T> matcher)
wrapped
- wrapped objectmatcher
- matcher used for equality checkspublic HashCacheWrapper(T wrapped, @NotNull HashCodeCalculator<? super T> hashCodeCalculator, @Nullable UniformMatcher<? super T> matcher)
wrapped
- wrapped objecthashCodeCalculator
- hash code calculatormatcher
- matcher for equality checks, if null
Match.DEFAULT_MATCHER
will be usedpublic T getWrapped()
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object