You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by tn...@apache.org on 2012/07/26 22:24:27 UTC

svn commit: r1366185 - /commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/functors/EqualPredicate.java

Author: tn
Date: Thu Jul 26 20:24:27 2012
New Revision: 1366185

URL: http://svn.apache.org/viewvc?rev=1366185&view=rev
Log:
[COLLECTIONS-239] to keep backwards compatibility, do not use DefaultEquator in case no equator is specific, but rather use the original equals method.

Modified:
    commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/functors/EqualPredicate.java

Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/functors/EqualPredicate.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/functors/EqualPredicate.java?rev=1366185&r1=1366184&r2=1366185&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/functors/EqualPredicate.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/functors/EqualPredicate.java Thu Jul 26 20:24:27 2012
@@ -79,7 +79,9 @@ public final class EqualPredicate<T> imp
      * @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> imp
      * @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);
+        }
     }
 
     /**