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


@Beta
@GwtCompatible
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(@Nullable
                   T a,
                   @Nullable
                   T b)
Returns true if the given objects are considered equivalent.

The equivalent method implements an equivalence relation on object references:


hash

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

See Also:
the same contractual obligations apply here