You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by mb...@apache.org on 2008/04/09 21:48:05 UTC

svn commit: r646504 - /commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/collection/IsElementOf.java

Author: mbenson
Date: Wed Apr  9 12:48:03 2008
New Revision: 646504

URL: http://svn.apache.org/viewvc?rev=646504&view=rev
Log:
return a little quicker from null:null element comparison

Modified:
    commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/collection/IsElementOf.java

Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/collection/IsElementOf.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/collection/IsElementOf.java?rev=646504&r1=646503&r2=646504&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/collection/IsElementOf.java (original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/collection/IsElementOf.java Wed Apr  9 12:48:03 2008
@@ -105,11 +105,10 @@
     private boolean testArray(Object obj, Object array) {
         for (int i = 0, m = Array.getLength(array); i < m; i++) {
             Object value = Array.get(array, i);
-            if (null == obj) {
-                if (null == value) {
-                    return true;
-                }
-            } else if (obj.equals(value)) {
+            if (obj == value) {
+                return true;
+            }
+            if (obj != null && obj.equals(value)) {
                 return true;
             }
         }