com.google.common.base
Interface Equivalence<T>


@Beta
public interface Equivalence<T>

A strategy for determining whether two instances are considered equivalent. Examples of equivalences are the identity equivalence and equals equivalence.

Since:
4
Author:
Bob Lee

Method Summary
 boolean equivalent(T a, T b)
          Returns true if the given objects are considered equivalent.
 int hash(T t)
          Returns a hash code for object.
 

Method Detail

equivalent

boolean equivalent(T a,
                   T b)
Returns true if the given objects are considered equivalent.

The equivalent method implements an equivalence relation on non-null object references:


hash

int hash(T t)
Returns a hash code for object. This function must return the same value for any two instances which are equivalent(T, T), and should as often as possible return a distinct value for instances which are not equivalent.

Throws:
NullPointerException - if t is null
See Also:
the same contractual obligations apply here