[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:
Thomas Neidhart 2012-07-26 20:24:27 +00:00
parent bb72bc51ce
commit 459f14b33c
1 changed files with 8 additions and 2 deletions

View File

@ -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);
}
}
/**