Class Equivalence.Wrapper<T extends @Nullable Object>

java.lang.Object
com.google.common.base.Equivalence.Wrapper<T>
All Implemented Interfaces:
Serializable
Enclosing class:
Equivalence<T>

public static final class Equivalence.Wrapper<T extends @Nullable Object> extends Object implements Serializable
Wraps an object so that equals(Object) and hashCode() delegate to an Equivalence.

For example, given an Equivalence for strings named equiv that tests equivalence using their lengths:


 equiv.wrap("a").equals(equiv.wrap("b")) // true
 equiv.wrap("a").equals(equiv.wrap("hello")) // false
 

Note in particular that an equivalence wrapper is never equal to the object it wraps.


 equiv.wrap(obj).equals(obj) // always false
 
Since:
10.0
Author:
Bob Lee, Ben Yu, Gregory Kick
See Also: