Interface Hasher.ImmutableHashCode<E>

Type Parameters:
E -
All Superinterfaces:
Hasher<E>
All Known Subinterfaces:
HashEqualator.IdentityHashEqualator<E>, HashEqualator.ImmutableHashEqualator<E>, HashEqualator.ImmutableValueTypeHashEqualator<E>, Hasher.IdentityHashCode<E>
Enclosing interface:
Hasher<T>

public static interface Hasher.ImmutableHashCode<E>
extends Hasher<E>
Type interface to indicate that the implementing Hasher implementation will always return the same hash value for the same object.
This is true for immutable objects (such as instances of String) or for the identity hash code provided by System.identityHashCode(Object).
The behavior can also be achieved by caching a once created hash code object-externally in the Hasherimplementation to ensure unchanging hash codes even for objects that are mutable in terms of their Object.equals(Object) implemententation.

The purpose of this marker interface is to indicate that using an implementation of it will not create hash values that will mess up a hash-based element distribution, which allows certain algorithm optimisations, for example in hashing collections.

See Also:
Hasher.IdentityHashCode