Class DefaultEquator<T>
java.lang.Object
org.apache.commons.collections4.functors.DefaultEquator<T>
- Type Parameters:
T
- the types of object thisEquator
can evaluate.
- All Implemented Interfaces:
Serializable
,Equator<T>
Default
Equator
implementation.- Since:
- 4.0
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
Hashcode used fornull
objects.static final DefaultEquator
Static instance -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> DefaultEquator<T>
Factory returning the typed singleton instance.boolean
Evaluates the two arguments for their equality.int
Calculates the hash for the object, based on the method of equality used in the equate method.
-
Field Details
-
INSTANCE
Static instance -
HASHCODE_NULL
Hashcode used fornull
objects.- See Also:
-
-
Method Details
-
defaultEquator
Factory returning the typed singleton instance.- Type Parameters:
T
- the object type- Returns:
- the singleton instance
-
equate
Evaluates the two arguments for their equality. Delegates toObjects.equals(Object, Object)
. -
hash
Calculates the hash for the object, based on the method of equality used in the equate method. This is used for classes that delegate theirequals(Object)
method to an Equator (and so must also delegate theirhashCode()
method), or for implementations ofHashedMap
that use an Equator for the key objects.- Specified by:
hash
in interfaceEquator<T>
- Parameters:
o
- the object to calculate the hash for.- Returns:
o.hashCode()
ifo
is non-null
, elseHASHCODE_NULL
.
-