commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mben...@apache.org
Subject svn commit: r813984 - /commons/proper/lang/trunk/src/java/org/apache/commons/lang/ArrayUtils.java
Date Fri, 11 Sep 2009 18:56:25 GMT
Author: mbenson
Date: Fri Sep 11 18:56:24 2009
New Revision: 813984

URL: http://svn.apache.org/viewvc?rev=813984&view=rev
Log:
add quick type compatibility check

Modified:
    commons/proper/lang/trunk/src/java/org/apache/commons/lang/ArrayUtils.java

Modified: commons/proper/lang/trunk/src/java/org/apache/commons/lang/ArrayUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/java/org/apache/commons/lang/ArrayUtils.java?rev=813984&r1=813983&r2=813984&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/java/org/apache/commons/lang/ArrayUtils.java (original)
+++ commons/proper/lang/trunk/src/java/org/apache/commons/lang/ArrayUtils.java Fri Sep 11
18:56:24 2009
@@ -1239,7 +1239,7 @@
                     return i;
                 }
             }
-        } else {//TODO add quick type compatibility check
+        } else if (array.getClass().getComponentType().isInstance(objectToFind)) {
             for (int i = startIndex; i < array.length; i++) {
                 if (objectToFind.equals(array[i])) {
                     return i;
@@ -1292,7 +1292,7 @@
                     return i;
                 }
             }
-        } else {//TODO as above
+        } else if (array.getClass().getComponentType().isInstance(objectToFind)) {
             for (int i = startIndex; i >= 0; i--) {
                 if (objectToFind.equals(array[i])) {
                     return i;



Mime
View raw message