Package gnu.trove.strategy
Interface HashingStrategy<T>
-
- All Superinterfaces:
java.io.Serializable
- All Known Implementing Classes:
IdentityHashingStrategy
public interface HashingStrategy<T> extends java.io.Serializable
Interface to support pluggable hashing strategies in maps and sets. Implementers can use this interface to make the trove hashing algorithms use object values, values provided by the java runtime, or a custom strategy when computing hashcodes.
-
-
Field Summary
Fields Modifier and Type Field Description static long
serialVersionUID
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description int
computeHashCode(T object)
Computes a hash code for the specified object.boolean
equals(T o1, T o2)
Compares o1 and o2 for equality.
-
-
-
Field Detail
-
serialVersionUID
static final long serialVersionUID
- See Also:
- Constant Field Values
-
-
Method Detail
-
computeHashCode
int computeHashCode(T object)
Computes a hash code for the specified object. Implementers can use the object's own hashCode method, the Java runtime's identityHashCode, or a custom scheme.- Parameters:
object
- for which the hashcode is to be computed- Returns:
- the hashCode
-
equals
boolean equals(T o1, T o2)
Compares o1 and o2 for equality. Strategy implementers may use the objects' own equals() methods, compare object references, or implement some custom scheme.- Parameters:
o1
- anObject
valueo2
- anObject
value- Returns:
- true if the objects are equal according to this strategy.
-
-