[COLLECTIONS-239] to keep backwards compatibility, do not use DefaultEquator in case no equator is specific, but rather use the original equals method.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/trunk@1366185 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
bb72bc51ce
commit
459f14b33c
|
@ -79,7 +79,9 @@ public final class EqualPredicate<T> implements Predicate<T>, Serializable {
|
|||
* @param object the object to compare to
|
||||
*/
|
||||
public EqualPredicate(T object) {
|
||||
this(object, new DefaultEquator<T>());
|
||||
// do not use the DefaultEquator to keep backwards compatibility
|
||||
// the DefaultEquator returns also true if the two object references are equal
|
||||
this(object, null);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -103,7 +105,11 @@ public final class EqualPredicate<T> implements Predicate<T>, Serializable {
|
|||
* @return true if input object equals stored value
|
||||
*/
|
||||
public boolean evaluate(T object) {
|
||||
return equator.equate(iValue, object);
|
||||
if (equator != null) {
|
||||
return equator.equate(iValue, object);
|
||||
} else {
|
||||
return iValue.equals(object);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue