Top Description Methods
org.apache.commons.collections4

public Interface Equator<T>

Known Direct Implementers
org.apache.commons.collections4.functors.DefaultEquator
Type Parameters
<T>
the types of object this Equator can evaluate.

An equation function, which determines equality between objects of type T.

It is the functional sibling of java.util.Comparator; Equator is to Object as java.util.Comparator is to java.lang.Comparable.

Since
4.0

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

whether the two objects are equal.
equate
(T
the first object to be equated.
o1
,
T
the second object to be equated.
o2
)

Evaluates the two arguments for their equality.

public int

Returns:

the hash of the object.
hash
(T
the object to calculate the hash for.
o
)

Calculates the hash for the object, based on the method of equality used in the equate method.

Method Detail

equateback to summary
public boolean equate(T o1, T o2)

Evaluates the two arguments for their equality.

Parameters
o1:T

the first object to be equated.

o2:T

the second object to be equated.

Returns:boolean

whether the two objects are equal.

hashback to summary
public int hash(T o)

Calculates the hash for the object, based on the method of equality used in the equate method. This is used for classes that delegate their equals(Object) method to an Equator (and so must also delegate their hashCode() method), or for implementations of org.apache.commons.collections4.map.HashedMap that use an Equator for the key objects.

Parameters
o:T

the object to calculate the hash for.

Returns:int

the hash of the object.