Package com.google.common.base
Class FunctionalEquivalence<F,T>
- java.lang.Object
-
- com.google.common.base.Equivalence<F>
-
- com.google.common.base.FunctionalEquivalence<F,T>
-
- All Implemented Interfaces:
java.io.Serializable
,java.util.function.BiPredicate<F,F>
@Beta @GwtCompatible final class FunctionalEquivalence<F,T> extends Equivalence<F> implements java.io.Serializable
Equivalence applied on functional result.- Since:
- 10.0
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.google.common.base.Equivalence
Equivalence.Equals, Equivalence.Identity, Equivalence.Wrapper<T>
-
-
Field Summary
Fields Modifier and Type Field Description private Function<F,? extends T>
function
private Equivalence<T>
resultEquivalence
private static long
serialVersionUID
-
Constructor Summary
Constructors Constructor Description FunctionalEquivalence(Function<F,? extends T> function, Equivalence<T> resultEquivalence)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
doEquivalent(F a, F b)
Implemented by the user to determine whethera
andb
are considered equivalent, subject to the requirements specified inEquivalence.equivalent(T, T)
.protected int
doHash(F a)
Implemented by the user to return a hash code fort
, subject to the requirements specified inEquivalence.hash(T)
.boolean
equals(java.lang.Object obj)
int
hashCode()
java.lang.String
toString()
-
Methods inherited from class com.google.common.base.Equivalence
equals, equivalent, equivalentTo, hash, identity, onResultOf, pairwise, test, wrap
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
resultEquivalence
private final Equivalence<T> resultEquivalence
-
-
Constructor Detail
-
FunctionalEquivalence
FunctionalEquivalence(Function<F,? extends T> function, Equivalence<T> resultEquivalence)
-
-
Method Detail
-
doEquivalent
protected boolean doEquivalent(F a, F b)
Description copied from class:Equivalence
Implemented by the user to determine whethera
andb
are considered equivalent, subject to the requirements specified inEquivalence.equivalent(T, T)
.This method should not be called except by
Equivalence.equivalent(T, T)
. WhenEquivalence.equivalent(T, T)
calls this method,a
andb
are guaranteed to be distinct, non-null instances.- Specified by:
doEquivalent
in classEquivalence<F>
-
doHash
protected int doHash(F a)
Description copied from class:Equivalence
Implemented by the user to return a hash code fort
, subject to the requirements specified inEquivalence.hash(T)
.This method should not be called except by
Equivalence.hash(T)
. WhenEquivalence.hash(T)
calls this method,t
is guaranteed to be non-null.- Specified by:
doHash
in classEquivalence<F>
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-