@Beta @GwtCompatible public final class Equivalences extends Object
Equivalence
instances.
All methods return serializable instances.
Modifier and Type | Method and Description |
---|---|
static Equivalence<Object> |
equals()
Returns an equivalence that delegates to
Object.equals(java.lang.Object) and Object.hashCode() . |
static Equivalence<Object> |
identity()
Returns an equivalence that uses
== to compare values and System.identityHashCode(Object) to compute the hash code. |
static <T> Equivalence<Iterable<T>> |
pairwise(Equivalence<? super T> elementEquivalence)
Returns an equivalence over iterables based on the equivalence of their elements.
|
public static Equivalence<Object> equals()
Object.equals(java.lang.Object)
and Object.hashCode()
.
Equivalence.equivalent(T, T)
returns true
if both values are null, or if neither
value is null and Object.equals(java.lang.Object)
returns true
. Equivalence.hash(T)
returns
0
if passed a null value.public static Equivalence<Object> identity()
==
to compare values and System.identityHashCode(Object)
to compute the hash code. Equivalence.equivalent(T, T)
returns true
if a == b
, including in the case that a and b are both null.@GwtCompatible(serializable=true) public static <T> Equivalence<Iterable<T>> pairwise(Equivalence<? super T> elementEquivalence)
elementEquivalence
. Null iterables are equivalent to one another.