You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ba...@apache.org on 2009/04/30 09:50:19 UTC

svn commit: r770101 - /commons/proper/lang/trunk/src/java/org/apache/commons/lang/BooleanUtils.java

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 {