Top Description Fields Constructors Methods
org.apache.commons.collections4.functors

public Class DefaultEquator<T>

extends Object
implements Equator<T>, Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable, org.apache.commons.collections4.Equator
Type Parameters
<T>
the types of object this Equator can evaluate.
Imports
java.io.Serializable, org.apache.commons.collections4.Equator

Default Equator implementation.
Since
4.0

Field Summary

Modifier and TypeField and Description
public static final int
HASHCODE_NULL

Hashcode used for null objects.

public static final DefaultEquator<T>
INSTANCE

Static instance

private static final long
serialVersionUID

Serial version UID

Constructor Summary

AccessConstructor and Description
private
DefaultEquator()

Restricted constructor.

Method Summary

Modifier and TypeMethod and Description
public static <
the object type
T
>
DefaultEquator<T>

Returns:

the singleton instance
defaultEquator
()

Factory returning the typed singleton instance.

public boolean
equate(final T
the first object to be equated.
o1
,
final T
the second object to be equated.
o2
)

Implements org.apache.commons.collections4.Equator.equate.

Evaluates the two arguments for their equality.
public int

Returns:

o.hashCode() if o is non- null, else HASHCODE_NULL.
hash
(final T
the object to calculate the hash for.
o
)

Implements org.apache.commons.collections4.Equator.hash.

Calculates the hash for the object, based on the method of equality used in the equate method.
private Object
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

HASHCODE_NULLback to summary
public static final int HASHCODE_NULL

Hashcode used for null objects.

INSTANCEback to summary
public static final DefaultEquator<T> INSTANCE

Static instance

Annotations
@SuppressWarnings:rawtypes
serialVersionUIDback to summary
private static final long serialVersionUID

Serial version UID

Constructor Detail

DefaultEquatorback to summary
private DefaultEquator()

Restricted constructor.

Method Detail

defaultEquatorback to summary
public static <T> DefaultEquator<T> defaultEquator()

Factory returning the typed singleton instance.

Parameters
<T>
the object type
Returns:DefaultEquator<T>

the singleton instance

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

Implements org.apache.commons.collections4.Equator.equate.

Doc from org.apache.commons.collections4.Equator.equate.

Evaluates the two arguments for their equality. Delegates to Object#equals(Object).

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.

Annotations
@Override
hashback to summary
public int hash(final T o)

Implements org.apache.commons.collections4.Equator.hash.

Doc from org.apache.commons.collections4.Equator.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 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

o.hashCode() if o is non- null, else HASHCODE_NULL.

Annotations
@Override
readResolveback to summary
private Object readResolve()