VALUE
- is the generic type of the values to check
.public interface EqualsChecker<VALUE>
equal
independent from the objects equals
method. It
allows to switch between equals
, same
or other
implementations. Additionally it is null
-aware. HashCodeFunction
has to be provided. Due to lambda
support we keep these aspects in separate functional interfaces. Containers that accept an EqualsChecker
should also accept a HashCodeFunction
for customization. Unfortunately Collection
s do not
allow such customization so you need to wrap objects before using them asModifier and Type | Method and Description |
---|---|
boolean |
isEqual(VALUE value1,
VALUE value2)
This method determines if the two given objects are
equal to each other in a way
semantically defined by this implementation. |
boolean isEqual(VALUE value1, VALUE value2)
equal
to each other in a way
semantically defined by this implementation. An implementation must fulfill the contract of the method
Object.equals(Object)
. This means it is:
isEquals(x, x) == true
, especially: isEquals(null, null) == true
isEquals(x, y) == isEquals(y, x)
(isEquals(x, y) == isEquals(y, z) == true)
implies isEquals(x, z)
isEquals(x, y)
will always return the same result if
x
and y
are unchanged.for all x != null: isEquals(x, null) == isEquals(null, x) == false
value1
- is the first value.value2
- is the second value.true
if both values are null
or both are NOT null
and equal to each other in the
way defined by this EqualsChecker
implementation, false
otherwise.Copyright © 2001–2016 mmm-Team. All rights reserved.