Package org.plumelib.util
Interface Hasher
public interface Hasher
Hasher
is intended to work like Comparable
: it is an optional argument to a
hashing data structure (such as some implementations of HashSet
, HashMap
, or
WeakHashMap
) which specifies the hashCode()
and equals()
methods.
If no Hasher is provided, then clients should act as if the following Hasher were provided:
class DefaultHasher { int hashCode(Object o) { return o.hashCode(); } boolean equals(Object o, Object o2) { return o.equals(o2); } }
-
Method Summary
-
Method Details
-
hashCode
hashCode function for objects under consideration (not for Hasher objects).- Parameters:
o
- object whose hash code to compute- Returns:
- o's hash code
-
equals
The equality function over the objects being hashed.Has nothing to do with testing Hashers themselves for equality.
- Parameters:
o1
- the first value to test for equalityo2
- the second value to test for equality- Returns:
- whether o1 equals o2
-