commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bay...@apache.org
Subject svn commit: r770101 - /commons/proper/lang/trunk/src/java/org/apache/commons/lang/BooleanUtils.java
Date Thu, 30 Apr 2009 07:50:19 GMT
Author: bayard
Date: Thu Apr 30 07:50:19 2009
New Revision: 770101

URL: http://svn.apache.org/viewvc?rev=770101&view=rev
Log:
Simplifying for loop

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

Modified: commons/proper/lang/trunk/src/java/org/apache/commons/lang/BooleanUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/java/org/apache/commons/lang/BooleanUtils.java?rev=770101&r1=770100&r2=770101&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/java/org/apache/commons/lang/BooleanUtils.java (original)
+++ commons/proper/lang/trunk/src/java/org/apache/commons/lang/BooleanUtils.java Thu Apr 30
07:50:19 2009
@@ -896,10 +896,10 @@
 
         // Loops through array, comparing each item
         int trueCount = 0;
-        for (int i = 0; i < array.length; i++) {
+        for (boolean element : array) {
             // If item is true, and trueCount is < 1, increments count
             // Else, xor fails
-            if (array[i]) {
+            if (element) {
                 if (trueCount < 1) {
                     trueCount++;
                 } else {



Mime
View raw message