commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject svn commit: r1429890 [1/2] - in /commons/proper/collections/trunk/src: main/java/org/apache/commons/collections/ main/java/org/apache/commons/collections/bag/ main/java/org/apache/commons/collections/buffer/ main/java/org/apache/commons/collections/col...
Date Mon, 07 Jan 2013 16:48:11 GMT
Author: ggregory
Date: Mon Jan  7 16:48:10 2013
New Revision: 1429890

URL: http://svn.apache.org/viewvc?rev=1429890&view=rev
Log:
Convert to Java 5 enhanced loops.

Modified:
    commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/CollectionUtils.java
    commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/ComparatorUtils.java
    commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/ExtendedProperties.java
    commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/MapUtils.java
    commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/bag/AbstractMapBag.java
    commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/bag/TransformedBag.java
    commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/bag/TransformedSortedBag.java
    commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/buffer/BoundedFifoBuffer.java
    commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/buffer/TransformedBuffer.java
    commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/buffer/UnboundedFifoBuffer.java
    commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/collection/TransformedCollection.java
    commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/comparators/FixedOrderComparator.java
    commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/functors/AnyPredicate.java
    commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/functors/ChainedClosure.java
    commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/functors/ChainedTransformer.java
    commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/functors/NonePredicate.java
    commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/functors/OnePredicate.java
    commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/iterators/CollatingIterator.java
    commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/iterators/IteratorChain.java
    commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/keyvalue/MultiKey.java
    commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/list/AbstractLinkedList.java
    commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/list/SetUniqueList.java
    commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/list/TransformedList.java
    commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/AbstractHashedMap.java
    commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/MultiValueMap.java
    commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/set/ListOrderedSet.java
    commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/set/TransformedSet.java
    commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/set/TransformedSortedSet.java
    commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/BulkTest.java
    commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/bag/AbstractBagTest.java
    commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/bag/TransformedBagTest.java
    commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/bag/TransformedSortedBagTest.java
    commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/buffer/TransformedBufferTest.java
    commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/collection/AbstractCollectionTest.java
    commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/collection/CompositeCollectionTest.java
    commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/collection/TransformedCollectionTest.java
    commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/comparators/FixedOrderComparatorTest.java
    commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/comparators/sequence/SequencesComparatorTest.java
    commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/iterators/ArrayIterator2Test.java
    commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/iterators/ArrayIteratorTest.java
    commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/iterators/FilterIteratorTest.java
    commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/iterators/IteratorChainTest.java
    commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/iterators/ListIteratorWrapper2Test.java
    commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/iterators/ListIteratorWrapperTest.java
    commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/iterators/ObjectArrayIteratorTest.java
    commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/iterators/UniqueFilterIteratorTest.java
    commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/list/AbstractListTest.java
    commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/list/CursorableLinkedListTest.java
    commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/list/SetUniqueListTest.java
    commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/list/TransformedListTest.java
    commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/AbstractMapTest.java
    commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/AbstractSortedMapTest.java
    commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/CaseInsensitiveMapTest.java
    commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/LRUMapTest.java
    commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/MultiKeyMapTest.java
    commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/MultiValueMapTest.java
    commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/set/TransformedSetTest.java
    commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/set/TransformedSortedSetTest.java

Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/CollectionUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/CollectionUtils.java?rev=1429890&r1=1429889&r2=1429890&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/CollectionUtils.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/CollectionUtils.java Mon Jan  7 16:48:10 2013
@@ -896,8 +896,8 @@ public class CollectionUtils {
      */
     public static <C> boolean addAll(Collection<C> collection, C[] elements) {
         boolean changed = false;
-        for (int i = 0, size = elements.length; i < size; i++) {
-            changed |= collection.add(elements[i]);
+        for (C element : elements) {
+            changed |= collection.add(element);
         }
         return changed;
     }

Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/ComparatorUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/ComparatorUtils.java?rev=1429890&r1=1429889&r2=1429890&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/ComparatorUtils.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/ComparatorUtils.java Mon Jan  7 16:48:10 2013
@@ -92,11 +92,11 @@ public class ComparatorUtils {
      */
     public static <E extends Comparable<? super E>> Comparator<E> chainedComparator(Comparator<E>[] comparators) {
         ComparatorChain<E> chain = new ComparatorChain<E>();
-        for (int i = 0; i < comparators.length; i++) {
-            if (comparators[i] == null) {
+        for (Comparator<E> comparator : comparators) {
+            if (comparator == null) {
                 throw new NullPointerException("Comparator cannot be null");
             }
-            chain.addComparator(comparators[i]);
+            chain.addComparator(comparator);
         }
         return chain;
     }

Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/ExtendedProperties.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/ExtendedProperties.java?rev=1429890&r1=1429889&r2=1429890&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/ExtendedProperties.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/ExtendedProperties.java Mon Jan  7 16:48:10 2013
@@ -756,8 +756,7 @@ public class ExtendedProperties extends 
                 } else if (value instanceof List) {
                     @SuppressWarnings("unchecked") // we only add Strings to the Lists
                     List<String> values = (List<String>) value;
-                    for (Iterator<String> it = values.iterator(); it.hasNext(); ) {
-                        String currentElement = it.next();
+                    for (String currentElement : values) {
                         StringBuilder currentOutput = new StringBuilder();
                         currentOutput.append(key);
                         currentOutput.append("=");
@@ -976,8 +975,7 @@ public class ExtendedProperties extends 
 
         // Each token is of the form 'key=value'.
         Properties props = new Properties(defaults);
-        for (int i = 0; i < tokens.length; i++) {
-            String token = tokens[i];
+        for (String token : tokens) {
             int equalSign = token.indexOf('=');
             if (equalSign > 0) {
                 String pkey = token.substring(0, equalSign).trim();
@@ -1738,8 +1736,7 @@ public class ExtendedProperties extends 
         } else {
             @SuppressWarnings("unchecked") // OK to downcast here
             Map<String, Object> mapso = (Map<String,Object>) map;
-            for (Iterator<Map.Entry<String, Object>> it = mapso.entrySet().iterator(); it.hasNext(); ) {
-                Map.Entry<String,Object> entry = it.next();
+            for (java.util.Map.Entry<String, Object> entry : mapso.entrySet()) {
                 put(entry.getKey(), entry.getValue());
             }
         }

Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/MapUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/MapUtils.java?rev=1429890&r1=1429889&r2=1429890&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/MapUtils.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/MapUtils.java Mon Jan  7 16:48:10 2013
@@ -25,6 +25,7 @@ import java.util.Enumeration;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Map;
+import java.util.Map.Entry;
 import java.util.Properties;
 import java.util.ResourceBundle;
 import java.util.SortedMap;
@@ -843,8 +844,8 @@ public class MapUtils {
     public static <K, V> Properties toProperties(final Map<K, V> map) {
         Properties answer = new Properties();
         if (map != null) {
-            for (Iterator<Map.Entry<K, V>> iter = map.entrySet().iterator(); iter.hasNext();) {
-                Map.Entry<?, ?> entry = iter.next();
+            for (Entry<K, V> entry2 : map.entrySet()) {
+                Map.Entry<?, ?> entry = entry2;
                 Object key = entry.getKey();
                 Object value = entry.getValue();
                 answer.put(key, value);
@@ -1049,8 +1050,7 @@ public class MapUtils {
      */
     public static <K, V> Map<V, K> invertMap(Map<K, V> map) {
         Map<V, K> out = new HashMap<V, K>(map.size());
-        for (Iterator<Map.Entry<K, V>> it = map.entrySet().iterator(); it.hasNext();) {
-            Map.Entry<K, V> entry = it.next();
+        for (Entry<K, V> entry : map.entrySet()) {
             out.put(entry.getValue(), entry.getKey());
         }
         return out;
@@ -1136,13 +1136,13 @@ public class MapUtils {
         }
         Object obj = array[0];
         if (obj instanceof Map.Entry) {
-            for (int i = 0; i < array.length; i++) {
-                Map.Entry<K, V> entry = (Map.Entry<K, V>) array[i];
+            for (Object element : array) {
+                Map.Entry<K, V> entry = (Map.Entry<K, V>) element;
                 map.put(entry.getKey(), entry.getValue());
             }
         } else if (obj instanceof KeyValue) {
-            for (int i = 0; i < array.length; i++) {
-                KeyValue<K, V> keyval = (KeyValue<K, V>) array[i];
+            for (Object element : array) {
+                KeyValue<K, V> keyval = (KeyValue<K, V>) element;
                 map.put(keyval.getKey(), keyval.getValue());
             }
         } else if (obj instanceof Object[]) {

Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/bag/AbstractMapBag.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/bag/AbstractMapBag.java?rev=1429890&r1=1429889&r2=1429890&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/bag/AbstractMapBag.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/bag/AbstractMapBag.java Mon Jan  7 16:48:10 2013
@@ -24,6 +24,7 @@ import java.util.Collection;
 import java.util.ConcurrentModificationException;
 import java.util.Iterator;
 import java.util.Map;
+import java.util.Map.Entry;
 import java.util.Set;
 
 import org.apache.commons.collections.Bag;
@@ -492,8 +493,7 @@ public abstract class AbstractMapBag<E> 
      */
     protected void doWriteObject(ObjectOutputStream out) throws IOException {
         out.writeInt(map.size());
-        for (Iterator<Map.Entry<E, MutableInteger>> it = map.entrySet().iterator(); it.hasNext();) {
-            Map.Entry<E, MutableInteger> entry = it.next();
+        for (Entry<E, MutableInteger> entry : map.entrySet()) {
             out.writeObject(entry.getKey());
             out.writeInt(entry.getValue().value);
         }
@@ -540,8 +540,7 @@ public abstract class AbstractMapBag<E> 
         if (other.size() != size()) {
             return false;
         }
-        for (Iterator<E> it = map.keySet().iterator(); it.hasNext();) {
-            E element = it.next();
+        for (E element : map.keySet()) {
             if (other.getCount(element) != getCount(element)) {
                 return false;
             }
@@ -561,8 +560,7 @@ public abstract class AbstractMapBag<E> 
     @Override
     public int hashCode() {
         int total = 0;
-        for (Iterator<Map.Entry<E, MutableInteger>> it = map.entrySet().iterator(); it.hasNext();) {
-            Map.Entry<E, MutableInteger> entry = it.next();
+        for (Entry<E, MutableInteger> entry : map.entrySet()) {
             E element = entry.getKey();
             MutableInteger count = entry.getValue();
             total += (element == null ? 0 : element.hashCode()) ^ count.value;

Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/bag/TransformedBag.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/bag/TransformedBag.java?rev=1429890&r1=1429889&r2=1429890&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/bag/TransformedBag.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/bag/TransformedBag.java Mon Jan  7 16:48:10 2013
@@ -78,8 +78,8 @@ public class TransformedBag<E> extends T
             @SuppressWarnings("unchecked") // Bag is of type E
             E[] values = (E[]) bag.toArray();
             bag.clear();
-            for (int i = 0; i < values.length; i++) {
-                decorated.decorated().add(transformer.transform(values[i]));
+            for (E value : values) {
+                decorated.decorated().add(transformer.transform(value));
             }
         }
         return decorated;

Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/bag/TransformedSortedBag.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/bag/TransformedSortedBag.java?rev=1429890&r1=1429889&r2=1429890&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/bag/TransformedSortedBag.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/bag/TransformedSortedBag.java Mon Jan  7 16:48:10 2013
@@ -78,8 +78,8 @@ public class TransformedSortedBag<E> ext
             @SuppressWarnings("unchecked") // bag is type E
             E[] values = (E[]) bag.toArray();
             bag.clear();
-            for(int i=0; i<values.length; i++) {
-                decorated.decorated().add(transformer.transform(values[i]));
+            for (E value : values) {
+                decorated.decorated().add(transformer.transform(value));
             }
         }
         return decorated;

Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/buffer/BoundedFifoBuffer.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/buffer/BoundedFifoBuffer.java?rev=1429890&r1=1429889&r2=1429890&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/buffer/BoundedFifoBuffer.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/buffer/BoundedFifoBuffer.java Mon Jan  7 16:48:10 2013
@@ -130,8 +130,8 @@ public class BoundedFifoBuffer<E> extend
     private void writeObject(ObjectOutputStream out) throws IOException {
         out.defaultWriteObject();
         out.writeInt(size());
-        for (Iterator<E> it = iterator(); it.hasNext();) {
-            out.writeObject(it.next());
+        for (E e : this) {
+            out.writeObject(e);
         }
     }
 

Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/buffer/TransformedBuffer.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/buffer/TransformedBuffer.java?rev=1429890&r1=1429889&r2=1429890&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/buffer/TransformedBuffer.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/buffer/TransformedBuffer.java Mon Jan  7 16:48:10 2013
@@ -79,8 +79,8 @@ public class TransformedBuffer<E> extend
             @SuppressWarnings("unchecked") // buffer is type <E>
             E[] values = (E[]) buffer.toArray();
             buffer.clear();
-            for(int i=0; i<values.length; i++) {
-                decorated.decorated().add(transformer.transform(values[i]));
+            for (E value : values) {
+                decorated.decorated().add(transformer.transform(value));
             }
         }
         return decorated;

Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/buffer/UnboundedFifoBuffer.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/buffer/UnboundedFifoBuffer.java?rev=1429890&r1=1429889&r2=1429890&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/buffer/UnboundedFifoBuffer.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/buffer/UnboundedFifoBuffer.java Mon Jan  7 16:48:10 2013
@@ -110,8 +110,8 @@ public class UnboundedFifoBuffer<E> exte
         out.defaultWriteObject();
         out.writeInt(size());
         out.writeInt(buffer.length);
-        for (Iterator<E> it = iterator(); it.hasNext();) {
-            out.writeObject(it.next());
+        for (E e : this) {
+            out.writeObject(e);
         }
     }
 

Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/collection/TransformedCollection.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/collection/TransformedCollection.java?rev=1429890&r1=1429889&r2=1429890&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/collection/TransformedCollection.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/collection/TransformedCollection.java Mon Jan  7 16:48:10 2013
@@ -85,8 +85,8 @@ public class TransformedCollection<E> ex
             @SuppressWarnings("unchecked") // collection is of type E
             E[] values = (E[]) collection.toArray();
             collection.clear();
-            for(int i=0; i<values.length; i++) {
-                decorated.decorated().add(transformer.transform(values[i]));
+            for (E value : values) {
+                decorated.decorated().add(transformer.transform(value));
             }
         }
         return decorated;

Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/comparators/FixedOrderComparator.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/comparators/FixedOrderComparator.java?rev=1429890&r1=1429889&r2=1429890&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/comparators/FixedOrderComparator.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/comparators/FixedOrderComparator.java Mon Jan  7 16:48:10 2013
@@ -94,8 +94,8 @@ public class FixedOrderComparator<T> imp
         if (items == null) {
             throw new IllegalArgumentException("The list of items must not be null");
         }
-        for (int i = 0; i < items.length; i++) {
-            add(items[i]);
+        for (T item : items) {
+            add(item);
         }
     }
 

Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/functors/AnyPredicate.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/functors/AnyPredicate.java?rev=1429890&r1=1429889&r2=1429890&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/functors/AnyPredicate.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/functors/AnyPredicate.java Mon Jan  7 16:48:10 2013
@@ -106,8 +106,8 @@ public final class AnyPredicate<T> imple
      * @return true if any decorated predicate return true
      */
     public boolean evaluate(T object) {
-        for (int i = 0; i < iPredicates.length; i++) {
-            if (iPredicates[i].evaluate(object)) {
+        for (Predicate<? super T> iPredicate : iPredicates) {
+            if (iPredicate.evaluate(object)) {
                 return true;
             }
         }

Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/functors/ChainedClosure.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/functors/ChainedClosure.java?rev=1429890&r1=1429889&r2=1429890&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/functors/ChainedClosure.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/functors/ChainedClosure.java Mon Jan  7 16:48:10 2013
@@ -98,8 +98,8 @@ public class ChainedClosure<E> implement
      * @param input  the input object passed to each closure
      */
     public void execute(E input) {
-        for (int i = 0; i < iClosures.length; i++) {
-            iClosures[i].execute(input);
+        for (Closure<? super E> iClosure : iClosures) {
+            iClosure.execute(input);
         }
     }
 

Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/functors/ChainedTransformer.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/functors/ChainedTransformer.java?rev=1429890&r1=1429889&r2=1429890&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/functors/ChainedTransformer.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/functors/ChainedTransformer.java Mon Jan  7 16:48:10 2013
@@ -96,8 +96,8 @@ public class ChainedTransformer<T> imple
      * @return the transformed result
      */
     public T transform(T object) {
-        for (int i = 0; i < iTransformers.length; i++) {
-            object = iTransformers[i].transform(object);
+        for (Transformer<? super T, ? extends T> iTransformer : iTransformers) {
+            object = iTransformer.transform(object);
         }
         return object;
     }

Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/functors/NonePredicate.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/functors/NonePredicate.java?rev=1429890&r1=1429889&r2=1429890&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/functors/NonePredicate.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/functors/NonePredicate.java Mon Jan  7 16:48:10 2013
@@ -96,8 +96,8 @@ public final class NonePredicate<T> impl
      * @return true if none of decorated predicates return true
      */
     public boolean evaluate(T object) {
-        for (int i = 0; i < iPredicates.length; i++) {
-            if (iPredicates[i].evaluate(object)) {
+        for (Predicate<? super T> iPredicate : iPredicates) {
+            if (iPredicate.evaluate(object)) {
                 return false;
             }
         }

Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/functors/OnePredicate.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/functors/OnePredicate.java?rev=1429890&r1=1429889&r2=1429890&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/functors/OnePredicate.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/functors/OnePredicate.java Mon Jan  7 16:48:10 2013
@@ -98,8 +98,8 @@ public final class OnePredicate<T> imple
      */
     public boolean evaluate(T object) {
         boolean match = false;
-        for (int i = 0; i < iPredicates.length; i++) {
-            if (iPredicates[i].evaluate(object)) {
+        for (Predicate<? super T> iPredicate : iPredicates) {
+            if (iPredicate.evaluate(object)) {
                 if (match) {
                     return false;
                 }

Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/iterators/CollatingIterator.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/iterators/CollatingIterator.java?rev=1429890&r1=1429889&r2=1429890&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/iterators/CollatingIterator.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/iterators/CollatingIterator.java Mon Jan  7 16:48:10 2013
@@ -133,8 +133,8 @@ public class CollatingIterator<E> implem
      */
     public CollatingIterator(final Comparator<? super E> comp, final Iterator<? extends E>[] iterators) {
         this(comp, iterators.length);
-        for (int i = 0; i < iterators.length; i++) {
-            addIterator(iterators[i]);
+        for (Iterator<? extends E> iterator : iterators) {
+            addIterator(iterator);
         }
     }
 

Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/iterators/IteratorChain.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/iterators/IteratorChain.java?rev=1429890&r1=1429889&r2=1429890&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/iterators/IteratorChain.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/iterators/IteratorChain.java Mon Jan  7 16:48:10 2013
@@ -125,8 +125,8 @@ public class IteratorChain<E> implements
      */
     public IteratorChain(Iterator<? extends E>... iteratorChain) {
         super();
-        for (int i = 0; i < iteratorChain.length; i++) {
-            addIterator(iteratorChain[i]);
+        for (Iterator<? extends E> element : iteratorChain) {
+            addIterator(element);
         }
     }
 

Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/keyvalue/MultiKey.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/keyvalue/MultiKey.java?rev=1429890&r1=1429889&r2=1429890&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/keyvalue/MultiKey.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/keyvalue/MultiKey.java Mon Jan  7 16:48:10 2013
@@ -260,9 +260,9 @@ public class MultiKey<K> implements Seri
     private void calculateHashCode(Object[] keys)
     {
         int total = 0;
-        for (int i = 0; i < keys.length; i++) {
-            if (keys[i] != null) {
-                total ^= keys[i].hashCode();
+        for (Object key : keys) {
+            if (key != null) {
+                total ^= key.hashCode();
             }
         }
         hashCode = total;

Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/list/AbstractLinkedList.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/list/AbstractLinkedList.java?rev=1429890&r1=1429889&r2=1429890&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/list/AbstractLinkedList.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/list/AbstractLinkedList.java Mon Jan  7 16:48:10 2013
@@ -598,8 +598,8 @@ public abstract class AbstractLinkedList
     protected void doWriteObject(ObjectOutputStream outputStream) throws IOException {
         // Write the size so we know how many nodes to read back
         outputStream.writeInt(size());
-        for (Iterator<E> itr = iterator(); itr.hasNext();) {
-            outputStream.writeObject(itr.next());
+        for (E e : this) {
+            outputStream.writeObject(e);
         }
     }
 

Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/list/SetUniqueList.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/list/SetUniqueList.java?rev=1429890&r1=1429889&r2=1429890&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/list/SetUniqueList.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/list/SetUniqueList.java Mon Jan  7 16:48:10 2013
@@ -259,8 +259,8 @@ public class SetUniqueList<E> extends Ab
     @Override
     public boolean removeAll(Collection<?> coll) {
         boolean result = false;
-        for (Iterator<?> it = coll.iterator(); it.hasNext();) {
-            result |= remove(it.next());
+        for (Object name : coll) {
+            result |= remove(name);
         }
         return result;
     }
@@ -268,8 +268,7 @@ public class SetUniqueList<E> extends Ab
     @Override
     public boolean retainAll(Collection<?> coll) {
         Set<Object> setRetainAll = new HashSet<Object>();
-        for (Iterator<?> it = coll.iterator(); it.hasNext();) {
-            Object next = it.next();
+        for (Object next : coll) {
             if (set.contains(next)) {
                 setRetainAll.add(next);
             }

Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/list/TransformedList.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/list/TransformedList.java?rev=1429890&r1=1429889&r2=1429890&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/list/TransformedList.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/list/TransformedList.java Mon Jan  7 16:48:10 2013
@@ -82,8 +82,8 @@ public class TransformedList<E> extends 
             @SuppressWarnings("unchecked") // list is of type E
             E[] values = (E[]) list.toArray();
             list.clear();
-            for(int i=0; i<values.length; i++) {
-                decorated.decorated().add(transformer.transform(values[i]));
+            for (E value : values) {
+                decorated.decorated().add(transformer.transform(value));
             }
         }
         return decorated;

Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/AbstractHashedMap.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/AbstractHashedMap.java?rev=1429890&r1=1429889&r2=1429890&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/AbstractHashedMap.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/AbstractHashedMap.java Mon Jan  7 16:48:10 2013
@@ -239,8 +239,8 @@ public class AbstractHashedMap<K, V> ext
     @Override
     public boolean containsValue(Object value) {
         if (value == null) {
-            for (int i = 0, isize = data.length; i < isize; i++) {
-                HashEntry<K, V> entry = data[i];
+            for (HashEntry<K, V> element : data) {
+                HashEntry<K, V> entry = element;
                 while (entry != null) {
                     if (entry.getValue() == null) {
                         return true;
@@ -249,8 +249,8 @@ public class AbstractHashedMap<K, V> ext
                 }
             }
         } else {
-            for (int i = 0, isize = data.length; i < isize; i++) {
-                HashEntry<K, V> entry = data[i];
+            for (HashEntry<K, V> element : data) {
+                HashEntry<K, V> entry = element;
                 while (entry != null) {
                     if (isEqualValue(value, entry.getValue())) {
                         return true;

Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/MultiValueMap.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/MultiValueMap.java?rev=1429890&r1=1429889&r2=1429890&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/MultiValueMap.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/MultiValueMap.java Mon Jan  7 16:48:10 2013
@@ -419,8 +419,8 @@ public class MultiValueMap<K, V> extends
         @Override
         public Iterator<V> iterator() {
             final IteratorChain<V> chain = new IteratorChain<V>();
-            for (Iterator<K> it = keySet().iterator(); it.hasNext();) {
-                chain.addIterator(new ValuesIterator(it.next()));
+            for (K k : keySet()) {
+                chain.addIterator(new ValuesIterator(k));
             }
             return chain;
         }

Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/set/ListOrderedSet.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/set/ListOrderedSet.java?rev=1429890&r1=1429889&r2=1429890&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/set/ListOrderedSet.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/set/ListOrderedSet.java Mon Jan  7 16:48:10 2013
@@ -218,8 +218,8 @@ public class ListOrderedSet<E>
     @Override
     public boolean removeAll(Collection<?> coll) {
         boolean result = false;
-        for (Iterator<?> it = coll.iterator(); it.hasNext();) {
-            result |= remove(it.next());
+        for (Object name : coll) {
+            result |= remove(name);
         }
         return result;
     }
@@ -227,8 +227,7 @@ public class ListOrderedSet<E>
     @Override
     public boolean retainAll(Collection<?> coll) {
         Set<Object> collectionRetainAll = new HashSet<Object>();
-        for (Iterator<?> it = coll.iterator(); it.hasNext();) {
-            Object next = it.next();
+        for (Object next : coll) {
             if (collection.contains(next)) {
                 collectionRetainAll.add(next);
             }

Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/set/TransformedSet.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/set/TransformedSet.java?rev=1429890&r1=1429889&r2=1429890&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/set/TransformedSet.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/set/TransformedSet.java Mon Jan  7 16:48:10 2013
@@ -77,8 +77,8 @@ public class TransformedSet<E> extends T
             @SuppressWarnings("unchecked") // set is type E
             E[] values = (E[]) set.toArray();
             set.clear();
-            for(int i=0; i<values.length; i++) {
-                decorated.decorated().add(transformer.transform(values[i]));
+            for (E value : values) {
+                decorated.decorated().add(transformer.transform(value));
             }
         }
         return decorated;

Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/set/TransformedSortedSet.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/set/TransformedSortedSet.java?rev=1429890&r1=1429889&r2=1429890&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/set/TransformedSortedSet.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/set/TransformedSortedSet.java Mon Jan  7 16:48:10 2013
@@ -79,8 +79,8 @@ public class TransformedSortedSet<E> ext
             @SuppressWarnings("unchecked") // set is type E
             E[] values = (E[]) set.toArray();
             set.clear();
-            for(int i=0; i<values.length; i++) {
-                decorated.decorated().add(transformer.transform(values[i]));
+            for (E value : values) {
+                decorated.decorated().add(transformer.transform(value));
             }
         }
         return decorated;

Modified: commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/BulkTest.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/BulkTest.java?rev=1429890&r1=1429889&r2=1429890&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/BulkTest.java (original)
+++ commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/BulkTest.java Mon Jan  7 16:48:10 2013
@@ -323,9 +323,9 @@ class BulkTestSuiteMaker {
     void make(BulkTest bulk) {
         Class<? extends BulkTest> c = bulk.getClass();
         Method[] all = c.getMethods();
-        for (int i = 0; i < all.length; i++) {
-            if (isTest(all[i])) addTest(bulk, all[i]);
-            if (isBulk(all[i])) addBulk(bulk, all[i]);
+        for (Method element : all) {
+            if (isTest(element)) addTest(bulk, element);
+            if (isBulk(element)) addBulk(bulk, element);
         }
     }
 
@@ -431,8 +431,8 @@ class BulkTestSuiteMaker {
 
     private static <T extends BulkTest> BulkTest makeFirstTestCase(Class<T> c) {
         Method[] all = c.getMethods();
-        for (int i = 0; i < all.length; i++) {
-            if (isTest(all[i])) return makeTestCase(c, all[i]);
+        for (Method element : all) {
+            if (isTest(element)) return makeTestCase(c, element);
         }
         throw new IllegalArgumentException(c.getName() + " must provide " 
           + " at least one test method.");

Modified: commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/bag/AbstractBagTest.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/bag/AbstractBagTest.java?rev=1429890&r1=1429889&r2=1429890&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/bag/AbstractBagTest.java (original)
+++ commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/bag/AbstractBagTest.java Mon Jan  7 16:48:10 2013
@@ -353,10 +353,10 @@ public abstract class AbstractBagTest<T>
         bag.add((T) "C");
         Object[] array = bag.toArray();
         int a = 0, b = 0, c = 0;
-        for (int i = 0; i < array.length; i++) {
-            a += (array[i].equals("A") ? 1 : 0);
-            b += (array[i].equals("B") ? 1 : 0);
-            c += (array[i].equals("C") ? 1 : 0);
+        for (Object element : array) {
+            a += (element.equals("A") ? 1 : 0);
+            b += (element.equals("B") ? 1 : 0);
+            c += (element.equals("C") ? 1 : 0);
         }
         assertEquals(2, a);
         assertEquals(2, b);
@@ -373,10 +373,10 @@ public abstract class AbstractBagTest<T>
         bag.add((T) "C");
         String[] array = bag.toArray(new String[0]);
         int a = 0, b = 0, c = 0;
-        for (int i = 0; i < array.length; i++) {
-            a += (array[i].equals("A") ? 1 : 0);
-            b += (array[i].equals("B") ? 1 : 0);
-            c += (array[i].equals("C") ? 1 : 0);
+        for (String element : array) {
+            a += (element.equals("A") ? 1 : 0);
+            b += (element.equals("B") ? 1 : 0);
+            c += (element.equals("C") ? 1 : 0);
         }
         assertEquals(2, a);
         assertEquals(2, b);

Modified: commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/bag/TransformedBagTest.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/bag/TransformedBagTest.java?rev=1429890&r1=1429889&r2=1429890&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/bag/TransformedBagTest.java (original)
+++ commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/bag/TransformedBagTest.java Mon Jan  7 16:48:10 2013
@@ -62,15 +62,15 @@ public class TransformedBagTest<T> exten
     public void testTransformedBag_decorateTransform() {
         Bag<T> originalBag = new HashBag<T>();
         Object[] els = new Object[] {"1", "3", "5", "7", "2", "4", "6"};
-        for (int i = 0; i < els.length; i++) {
-            originalBag.add((T) els[i]);
+        for (Object el : els) {
+            originalBag.add((T) el);
         }
         Bag<T> bag = TransformedBag.transformedBag(originalBag,
                 (Transformer<T, T>) TransformedCollectionTest.STRING_TO_INTEGER_TRANSFORMER);
         assertEquals(els.length, bag.size());
-        for (int i = 0; i < els.length; i++) {
-            assertEquals(true, bag.contains(new Integer((String) els[i])));
-            assertEquals(false, bag.contains(els[i]));
+        for (Object el : els) {
+            assertEquals(true, bag.contains(new Integer((String) el)));
+            assertEquals(false, bag.contains(el));
         }
         
         assertEquals(false, bag.remove(els[0]));

Modified: commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/bag/TransformedSortedBagTest.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/bag/TransformedSortedBagTest.java?rev=1429890&r1=1429889&r2=1429890&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/bag/TransformedSortedBagTest.java (original)
+++ commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/bag/TransformedSortedBagTest.java Mon Jan  7 16:48:10 2013
@@ -58,13 +58,13 @@ public class TransformedSortedBagTest<T>
     public void testTransformedBag_decorateTransform() {
         Bag<Object> originalBag = new TreeBag<Object>();
         Object[] els = new Object[] {"1", "3", "5", "7", "2", "4", "6"};
-        for (int i = 0; i < els.length; i++) {
-            originalBag.add(els[i]);
+        for (Object el : els) {
+            originalBag.add(el);
         }
         Bag<?> bag = TransformedBag.transformedBag(originalBag, TransformedCollectionTest.STRING_TO_INTEGER_TRANSFORMER);
         assertEquals(els.length, bag.size());
-        for (int i = 0; i < els.length; i++) {
-            assertEquals(true, bag.contains(new Integer((String) els[i])));
+        for (Object el : els) {
+            assertEquals(true, bag.contains(new Integer((String) el)));
         }
         
         assertEquals(true, bag.remove(new Integer((String) els[0])));

Modified: commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/buffer/TransformedBufferTest.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/buffer/TransformedBufferTest.java?rev=1429890&r1=1429889&r2=1429890&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/buffer/TransformedBufferTest.java (original)
+++ commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/buffer/TransformedBufferTest.java Mon Jan  7 16:48:10 2013
@@ -53,14 +53,14 @@ public class TransformedBufferTest exten
     public void testTransformedBuffer_decorateTransform() {
         Buffer originalBuffer = new ArrayStack();
         Object[] els = new Object[] {"1", "3", "5", "7", "2", "4", "6"};
-        for (int i = 0; i < els.length; i++) {
-            originalBuffer.add(els[i]);
+        for (Object el : els) {
+            originalBuffer.add(el);
         }
         Buffer buffer = TransformedBuffer.transformedBuffer(originalBuffer, TransformedCollectionTest.STRING_TO_INTEGER_TRANSFORMER);
         assertEquals(els.length, buffer.size());
-        for (int i = 0; i < els.length; i++) {
-            assertEquals(true, buffer.contains(new Integer((String) els[i])));
-            assertEquals(false, buffer.contains(els[i]));
+        for (Object el : els) {
+            assertEquals(true, buffer.contains(new Integer((String) el)));
+            assertEquals(false, buffer.contains(el));
         }
         
         assertEquals(false, buffer.remove(els[0]));

Modified: commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/collection/AbstractCollectionTest.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/collection/AbstractCollectionTest.java?rev=1429890&r1=1429889&r2=1429890&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/collection/AbstractCollectionTest.java (original)
+++ commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/collection/AbstractCollectionTest.java Mon Jan  7 16:48:10 2013
@@ -500,10 +500,10 @@ public abstract class AbstractCollection
         if (!isAddSupported()) return;
 
         E[] elements = getFullElements();
-        for (int i = 0; i < elements.length; i++) {
+        for (E element : elements) {
             resetEmpty();
-            boolean r = getCollection().add(elements[i]);
-            getConfirmed().add(elements[i]);
+            boolean r = getCollection().add(element);
+            getConfirmed().add(element);
             verify();
             assertTrue("Empty collection changed after add", r);
             assertEquals("Collection size is 1 after first add", 1, getCollection().size());
@@ -511,13 +511,13 @@ public abstract class AbstractCollection
 
         resetEmpty();
         int size = 0;
-        for (int i = 0; i < elements.length; i++) {
-            boolean r = getCollection().add(elements[i]);
-            getConfirmed().add(elements[i]);
+        for (E element : elements) {
+            boolean r = getCollection().add(element);
+            getConfirmed().add(element);
             verify();
             if (r) size++;
             assertEquals("Collection size should grow after add", size, getCollection().size());
-            assertTrue("Collection should contain added element", getCollection().contains(elements[i]));
+            assertTrue("Collection should contain added element", getCollection().contains(element));
         }
     }
 
@@ -533,8 +533,8 @@ public abstract class AbstractCollection
         getConfirmed().addAll(Arrays.asList(elements));
         verify();
         assertTrue("Empty collection should change after addAll", r);
-        for (int i = 0; i < elements.length; i++) {
-            assertTrue("Collection should contain added element", getCollection().contains(elements[i]));
+        for (E element : elements) {
+            assertTrue("Collection should contain added element", getCollection().contains(element));
         }
 
         resetFull();
@@ -544,9 +544,9 @@ public abstract class AbstractCollection
         getConfirmed().addAll(Arrays.asList(elements));
         verify();
         assertTrue("Full collection should change after addAll", r);
-        for (int i = 0; i < elements.length; i++) {
+        for (E element : elements) {
             assertTrue("Full collection should contain added element",
-                    getCollection().contains(elements[i]));
+                    getCollection().contains(element));
         }
         assertEquals("Size should increase after addAll", size + elements.length, getCollection().size());
 
@@ -862,10 +862,10 @@ public abstract class AbstractCollection
         }
 
         int size = getCollection().size();
-        for (int i = 0; i < elements.length; i++) {
+        for (E element : elements) {
             resetFull();
-            assertTrue("Collection should remove extant element: " + elements[i],
-                    getCollection().remove(elements[i]));
+            assertTrue("Collection should remove extant element: " + element,
+                    getCollection().remove(element));
 
             // if the elements aren't distinguishable, we can just remove a
             // matching element from the confirmed collection and verify
@@ -876,7 +876,7 @@ public abstract class AbstractCollection
             //
             // see areEqualElementsDistinguishable()
             if (!areEqualElementsDistinguishable()) {
-                getConfirmed().remove(elements[i]);
+                getConfirmed().remove(element);
                 verify();
             }
 
@@ -1043,9 +1043,9 @@ public abstract class AbstractCollection
                         + "in the confirmed collection's array");
             }
         }
-        for (int i = 0; i < matched.length; i++) {
+        for (boolean element : matched) {
             assertEquals("Collection should return all its elements in " + "toArray", true,
-                    matched[i]);
+                    element);
         }
     }
 
@@ -1085,8 +1085,8 @@ public abstract class AbstractCollection
         // Figure out if they're all the same class
         // TODO: It'd be nicer to detect a common superclass
         HashSet<Class<?>> classes = new HashSet<Class<?>>();
-        for (int i = 0; i < array.length; i++) {
-            classes.add((array[i] == null) ? null : array[i].getClass());
+        for (Object element : array) {
+            classes.add((element == null) ? null : element.getClass());
         }
         if (classes.size() > 1) return;
 

Modified: commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/collection/CompositeCollectionTest.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/collection/CompositeCollectionTest.java?rev=1429890&r1=1429889&r2=1429890&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/collection/CompositeCollectionTest.java (original)
+++ commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/collection/CompositeCollectionTest.java Mon Jan  7 16:48:10 2013
@@ -76,9 +76,9 @@ public class CompositeCollectionTest<E> 
     public Collection<E> makeFullCollection() {
         CompositeCollection<E> compositeCollection = new CompositeCollection<E>();
         E[] elements = getFullElements();
-        for (int i = 0; i < elements.length; i++) {
+        for (E element : elements) {
             Collection<E> summand = new HashSet<E>();
-            summand.add(elements[i]);
+            summand.add(element);
             compositeCollection.addComposited(summand);
         }
         return compositeCollection;

Modified: commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/collection/TransformedCollectionTest.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/collection/TransformedCollectionTest.java?rev=1429890&r1=1429889&r2=1429890&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/collection/TransformedCollectionTest.java (original)
+++ commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/collection/TransformedCollectionTest.java Mon Jan  7 16:48:10 2013
@@ -100,14 +100,14 @@ public class TransformedCollectionTest e
     public void testTransformedCollection_decorateTransform() {
         Collection originalCollection = new ArrayList();
         Object[] els = getFullElements();
-        for (int i = 0; i < els.length; i++) {
-            originalCollection.add(els[i]);
+        for (Object el : els) {
+            originalCollection.add(el);
         }
         Collection<Object> collection = TransformedCollection.transformedCollection(originalCollection, TransformedCollectionTest.STRING_TO_INTEGER_TRANSFORMER);
         assertEquals(els.length, collection.size());
-        for (int i = 0; i < els.length; i++) {
-            assertEquals(true, collection.contains(new Integer((String) els[i])));
-            assertEquals(false, collection.contains(els[i]));
+        for (Object el : els) {
+            assertEquals(true, collection.contains(new Integer((String) el)));
+            assertEquals(false, collection.contains(el));
         }
         
         assertEquals(false, collection.remove(els[0]));

Modified: commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/comparators/FixedOrderComparatorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/comparators/FixedOrderComparatorTest.java?rev=1429890&r1=1429889&r2=1429890&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/comparators/FixedOrderComparatorTest.java (original)
+++ commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/comparators/FixedOrderComparatorTest.java Mon Jan  7 16:48:10 2013
@@ -85,8 +85,8 @@ public class FixedOrderComparatorTest ex
     @Test
     public void testConstructorPlusAdd() {
         FixedOrderComparator<String> comparator = new FixedOrderComparator<String>();
-        for (int i = 0; i < topCities.length; i++) {
-            comparator.add(topCities[i]);
+        for (String topCitie : topCities) {
+            comparator.add(topCitie);
         }
         String[] keys = topCities.clone();
         assertComparatorYieldsOrder(keys, comparator);

Modified: commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/comparators/sequence/SequencesComparatorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/comparators/sequence/SequencesComparatorTest.java?rev=1429890&r1=1429889&r2=1429890&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/comparators/sequence/SequencesComparatorTest.java (original)
+++ commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/comparators/sequence/SequencesComparatorTest.java Mon Jan  7 16:48:10 2013
@@ -117,10 +117,10 @@ public class SequencesComparatorTest {
         for (int lg=0; lg<lgMax; ++lg) {
             List<List<String>> newTab = new ArrayList<List<String>>();
             newTab.add(new ArrayList<String>());
-            for (int k = 0; k < shadokAlph.length; k++) {
+            for (String element : shadokAlph) {
                 for (List<String> sentence : shadokSentences) {
                     List<String> newSentence = new ArrayList<String>(sentence);
-                    newSentence.add(shadokAlph[k]);
+                    newSentence.add(element);
                     newTab.add(newSentence);
                 }
             }

Modified: commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/iterators/ArrayIterator2Test.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/iterators/ArrayIterator2Test.java?rev=1429890&r1=1429889&r2=1429890&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/iterators/ArrayIterator2Test.java (original)
+++ commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/iterators/ArrayIterator2Test.java Mon Jan  7 16:48:10 2013
@@ -61,8 +61,8 @@ public class ArrayIterator2Test<E> exten
 
     public void testIterator() {
         Iterator<E> iter = makeObject();
-        for (int i = 0; i < testArray.length; i++) {
-            Integer testValue = new Integer(testArray[i]);
+        for (int element : testArray) {
+            Integer testValue = new Integer(element);
             Number iterValue = (Number) iter.next();
 
             assertEquals("Iteration value is correct", testValue, iterValue);

Modified: commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/iterators/ArrayIteratorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/iterators/ArrayIteratorTest.java?rev=1429890&r1=1429889&r2=1429890&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/iterators/ArrayIteratorTest.java (original)
+++ commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/iterators/ArrayIteratorTest.java Mon Jan  7 16:48:10 2013
@@ -51,8 +51,7 @@ public class ArrayIteratorTest<E> extend
 
     public void testIterator() {
         Iterator<E> iter = makeObject();
-        for (int i = 0; i < testArray.length; i++) {
-            Object testValue = testArray[i];
+        for (String testValue : testArray) {
             E iterValue = iter.next();
 
             assertEquals("Iteration value is correct", testValue, iterValue);

Modified: commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/iterators/FilterIteratorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/iterators/FilterIteratorTest.java?rev=1429890&r1=1429889&r2=1429890&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/iterators/FilterIteratorTest.java (original)
+++ commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/iterators/FilterIteratorTest.java Mon Jan  7 16:48:10 2013
@@ -92,7 +92,7 @@ public class FilterIteratorTest<E> exten
     }
 
     public void testRepeatedNext() {
-        for (int i = 0; i < array.length; i++) {
+        for (String element : array) {
             iterator.next();
         }
         verifyNoMoreElements();
@@ -159,8 +159,8 @@ public class FilterIteratorTest<E> exten
     private void verifyElementsInPredicate(final String[] elements) {
         Predicate<E> pred = new Predicate<E>() {
             public boolean evaluate(E x) {
-                for (int i = 0; i < elements.length; i++) {
-                    if (elements[i].equals(x)) {
+                for (String element : elements) {
+                    if (element.equals(x)) {
                         return true;
                     }
                 }

Modified: commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/iterators/IteratorChainTest.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/iterators/IteratorChainTest.java?rev=1429890&r1=1429889&r2=1429890&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/iterators/IteratorChainTest.java (original)
+++ commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/iterators/IteratorChainTest.java Mon Jan  7 16:48:10 2013
@@ -74,8 +74,7 @@ public class IteratorChainTest extends A
 
     public void testIterator() {
         Iterator<String> iter = makeObject();
-        for (int i = 0; i < testArray.length; i++) {
-            Object testValue = testArray[i];            
+        for (String testValue : testArray) {
             Object iterValue = iter.next();
 
             assertEquals( "Iteration value is correct", testValue, iterValue );
@@ -130,8 +129,7 @@ public class IteratorChainTest extends A
 
         }
 
-        for (int i = 0; i < testArray.length; i++) {
-            String testValue = testArray[i];            
+        for (String testValue : testArray) {
             String iterValue = iter.next();
 
             assertEquals("Iteration value is correct", testValue, iterValue);

Modified: commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/iterators/ListIteratorWrapper2Test.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/iterators/ListIteratorWrapper2Test.java?rev=1429890&r1=1429889&r2=1429890&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/iterators/ListIteratorWrapper2Test.java (original)
+++ commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/iterators/ListIteratorWrapper2Test.java Mon Jan  7 16:48:10 2013
@@ -65,8 +65,7 @@ public class ListIteratorWrapper2Test<E>
 
     public void testIterator() {
         ListIterator<E> iter = makeObject();
-        for (int i = 0; i < testArray.length; i++) {
-            Object testValue = testArray[i];
+        for (String testValue : testArray) {
             Object iterValue = iter.next();
 
             assertEquals("Iteration value is correct", testValue, iterValue);
@@ -97,8 +96,7 @@ public class ListIteratorWrapper2Test<E>
         }
 
         // now, read it forwards again
-        for (int i = 0; i < testArray.length; i++) {
-            Object testValue = testArray[i];
+        for (String testValue : testArray) {
             Object iterValue = iter.next();
 
             assertEquals("Iteration value is correct", testValue, iterValue);

Modified: commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/iterators/ListIteratorWrapperTest.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/iterators/ListIteratorWrapperTest.java?rev=1429890&r1=1429889&r2=1429890&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/iterators/ListIteratorWrapperTest.java (original)
+++ commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/iterators/ListIteratorWrapperTest.java Mon Jan  7 16:48:10 2013
@@ -66,8 +66,7 @@ public class ListIteratorWrapperTest<E> 
 
     public void testIterator() {
         ListIterator<E> iter = makeObject();
-        for (int i = 0; i < testArray.length; i++) {
-            Object testValue = testArray[i];
+        for (String testValue : testArray) {
             Object iterValue = iter.next();
 
             assertEquals("Iteration value is correct", testValue, iterValue);
@@ -98,8 +97,7 @@ public class ListIteratorWrapperTest<E> 
         }
 
         // now, read it forwards again
-        for (int i = 0; i < testArray.length; i++) {
-            Object testValue = testArray[i];
+        for (String testValue : testArray) {
             Object iterValue = iter.next();
 
             assertEquals("Iteration value is correct", testValue, iterValue);

Modified: commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/iterators/ObjectArrayIteratorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/iterators/ObjectArrayIteratorTest.java?rev=1429890&r1=1429889&r2=1429890&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/iterators/ObjectArrayIteratorTest.java (original)
+++ commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/iterators/ObjectArrayIteratorTest.java Mon Jan  7 16:48:10 2013
@@ -67,8 +67,7 @@ public class ObjectArrayIteratorTest<E> 
 
     public void testIterator() {
         Iterator<E> iter = makeObject();
-        for (int i = 0; i < testArray.length; i++) {
-            Object testValue = testArray[i];
+        for (String testValue : testArray) {
             E iterValue = iter.next();
 
             assertEquals("Iteration value is correct", testValue, iterValue);

Modified: commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/iterators/UniqueFilterIteratorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/iterators/UniqueFilterIteratorTest.java?rev=1429890&r1=1429889&r2=1429890&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/iterators/UniqueFilterIteratorTest.java (original)
+++ commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/iterators/UniqueFilterIteratorTest.java Mon Jan  7 16:48:10 2013
@@ -68,8 +68,7 @@ public class UniqueFilterIteratorTest<E>
 
     public void testIterator() {
         Iterator<E> iter = makeObject();
-        for (int i = 0; i < testArray.length; i++) {
-            Object testValue = testArray[i];            
+        for (String testValue : testArray) {
             E iterValue = iter.next();
 
             assertEquals( "Iteration value is correct", testValue, iterValue );

Modified: commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/list/AbstractListTest.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/list/AbstractListTest.java?rev=1429890&r1=1429889&r2=1429890&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/list/AbstractListTest.java (original)
+++ commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/list/AbstractListTest.java Mon Jan  7 16:48:10 2013
@@ -487,9 +487,9 @@ public abstract class AbstractListTest<E
         }
 
         E[] other = getOtherElements();
-        for (int i = 0; i < other.length; i++) {
+        for (E element : other) {
             assertEquals("indexOf should return -1 for nonexistent element",
-                -1, list1.indexOf(other[i]));
+                -1, list1.indexOf(element));
             verify();
         }
     }
@@ -511,9 +511,9 @@ public abstract class AbstractListTest<E
         }
 
         E[] other = getOtherElements();
-        for (int i = 0; i < other.length; i++) {
+        for (E element : other) {
             assertEquals("lastIndexOf should return -1 for nonexistent " +
-                "element", -1, list1.lastIndexOf(other[i]));
+                "element", -1, list1.lastIndexOf(element));
             verify();
         }
     }
@@ -974,20 +974,20 @@ public abstract class AbstractListTest<E
         ListIterator<E> iter1 = list1.listIterator();
         ListIterator<E> iter2 = list2.listIterator();
 
-        for (int i = 0; i < elements.length; i++) {
-            iter1.add(elements[i]);
-            iter2.add(elements[i]);
+        for (E element : elements) {
+            iter1.add(element);
+            iter2.add(element);
             verify();
         }
 
         resetFull();
         iter1 = getCollection().listIterator();
         iter2 = getConfirmed().listIterator();
-        for (int i = 0; i < elements.length; i++) {
+        for (E element : elements) {
             iter1.next();
             iter2.next();
-            iter1.add(elements[i]);
-            iter2.add(elements[i]);
+            iter1.add(element);
+            iter2.add(element);
             verify();
         }
     }
@@ -1004,11 +1004,11 @@ public abstract class AbstractListTest<E
         resetFull();
         ListIterator<E> iter1 = getCollection().listIterator();
         ListIterator<E> iter2 = getConfirmed().listIterator();
-        for (int i = 0; i < elements.length; i++) {
+        for (E element : elements) {
             iter1.next();
             iter2.next();
-            iter1.set(elements[i]);
-            iter2.set(elements[i]);
+            iter1.set(element);
+            iter2.set(element);
             verify();
         }
     }
@@ -1262,8 +1262,8 @@ public abstract class AbstractListTest<E
     */
    protected void failFastAll(List<E> list) {
        Method[] methods = List.class.getMethods();
-       for (int i = 0; i < methods.length; i++) {
-           failFastMethod(list, methods[i]);
+       for (Method method : methods) {
+           failFastMethod(list, method);
        }
    }
 

Modified: commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/list/CursorableLinkedListTest.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/list/CursorableLinkedListTest.java?rev=1429890&r1=1429889&r2=1429890&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/list/CursorableLinkedListTest.java (original)
+++ commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/list/CursorableLinkedListTest.java Mon Jan  7 16:48:10 2013
@@ -1516,9 +1516,9 @@ public class CursorableLinkedListTest<E>
                 ".testCanonicalFullCollectionExists",
                 ".testSerializeDeserializeThenCompare"
         };
-        for (int i = 0; i < ignored.length; i++) {
-            list.add(prefix + bulk + ignored[i]);
-            list.add(prefix + bulk + bulk + ignored[i]);
+        for (String element : ignored) {
+            list.add(prefix + bulk + element);
+            list.add(prefix + bulk + bulk + element);
         }
         return list.toArray(new String[0]);
     }

Modified: commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/list/SetUniqueListTest.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/list/SetUniqueListTest.java?rev=1429890&r1=1429889&r2=1429890&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/list/SetUniqueListTest.java (original)
+++ commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/list/SetUniqueListTest.java Mon Jan  7 16:48:10 2013
@@ -94,20 +94,20 @@ public class SetUniqueListTest<E> extend
         ListIterator<E> iter1 = list1.listIterator();
         ListIterator<E> iter2 = list2.listIterator();
 
-        for (int i = 0; i < elements.length; i++) {
-            iter1.add(elements[i]);
-            iter2.add(elements[i]);
+        for (E element : elements) {
+            iter1.add(element);
+            iter2.add(element);
             super.verify();  // changed here
         }
 
         resetFull();
         iter1 = getCollection().listIterator();
         iter2 = getConfirmed().listIterator();
-        for (int i = 0; i < elements.length; i++) {
+        for (E element : elements) {
             iter1.next();
             iter2.next();
-            iter1.add(elements[i]);
-            iter2.add(elements[i]);
+            iter1.add(element);
+            iter2.add(element);
             super.verify();  // changed here
         }
     }
@@ -121,9 +121,9 @@ public class SetUniqueListTest<E> extend
         getConfirmed().addAll(Arrays.asList(elements));
         verify();
         assertTrue("Empty collection should change after addAll", r);
-        for (int i = 0; i < elements.length; i++) {
+        for (E element : elements) {
             assertTrue("Collection should contain added element",
-                    getCollection().contains(elements[i]));
+                    getCollection().contains(element));
         }
 
         resetFull();

Modified: commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/list/TransformedListTest.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/list/TransformedListTest.java?rev=1429890&r1=1429889&r2=1429890&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/list/TransformedListTest.java (original)
+++ commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/list/TransformedListTest.java Mon Jan  7 16:48:10 2013
@@ -116,14 +116,14 @@ public class TransformedListTest<E> exte
     public void testTransformedList_decorateTransform() {
         List<Object> originalList = new ArrayList<Object>();
         Object[] els = new Object[] {"1", "3", "5", "7", "2", "4", "6"};
-        for (int i = 0; i < els.length; i++) {
-            originalList.add(els[i]);
+        for (Object el : els) {
+            originalList.add(el);
         }
         List<?> list = TransformedList.transformedList(originalList, TransformedCollectionTest.STRING_TO_INTEGER_TRANSFORMER);
         assertEquals(els.length, list.size());
-        for (int i = 0; i < els.length; i++) {
-            assertEquals(true, list.contains(new Integer((String) els[i])));
-            assertEquals(false, list.contains(els[i]));
+        for (Object el : els) {
+            assertEquals(true, list.contains(new Integer((String) el)));
+            assertEquals(false, list.contains(el));
         }
         
         assertEquals(false, list.remove(els[0]));

Modified: commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/AbstractMapTest.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/AbstractMapTest.java?rev=1429890&r1=1429889&r2=1429890&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/AbstractMapTest.java (original)
+++ commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/AbstractMapTest.java Mon Jan  7 16:48:10 2013
@@ -632,9 +632,9 @@ public abstract class AbstractMapTest<K,
         verify();
 
         resetFull();
-        for(int i = 0; i < keys.length; i++) {
+        for (Object key : keys) {
             assertTrue("Map must contain key for a mapping in the map. " +
-                       "Missing: " + keys[i], getMap().containsKey(keys[i]));
+                       "Missing: " + key, getMap().containsKey(key));
         }
         verify();
     }
@@ -655,9 +655,9 @@ public abstract class AbstractMapTest<K,
         verify();
 
         resetFull();
-        for(int i = 0; i < values.length; i++) {
+        for (Object value : values) {
             assertTrue("Map must contain value for a mapping in the map.",
-                    getMap().containsValue(values[i]));
+                    getMap().containsValue(value));
         }
         verify();
     }
@@ -699,9 +699,9 @@ public abstract class AbstractMapTest<K,
         Object[] keys = getSampleKeys();
         Object[] values = getSampleValues();
 
-        for (int i = 0; i < keys.length; i++) {
+        for (Object key : keys) {
             assertTrue("Empty map.get() should return null.",
-                    getMap().get(keys[i]) == null);
+                    getMap().get(key) == null);
         }
         verify();
 
@@ -992,8 +992,8 @@ public abstract class AbstractMapTest<K,
 
         Object[] keys = getSampleKeys();
         Object[] values = getSampleValues();
-        for (int i = 0; i < keys.length; i++) {
-            Object o = getMap().remove(keys[i]);
+        for (Object key : keys) {
+            Object o = getMap().remove(key);
             assertTrue("First map.remove should return null", o == null);
         }
         verify();
@@ -1013,8 +1013,8 @@ public abstract class AbstractMapTest<K,
 
         resetFull();
         int size = getMap().size();
-        for (int i = 0; i < other.length; i++) {
-            Object o = getMap().remove(other[i]);
+        for (Object element : other) {
+            Object o = getMap().remove(element);
             assertNull("map.remove for nonexistent key should return null", o);
             assertEquals("map.remove for nonexistent key should not " +
                          "shrink map", size, getMap().size());
@@ -2004,8 +2004,8 @@ public abstract class AbstractMapTest<K,
                    "\nTest: " + test + "\nReal: " + known,
                    known.containsAll(test));
         // originally coded to use a HashBag, but now separate jar so...
-        for (Iterator<V> it = known.iterator(); it.hasNext();) {
-            boolean removed = test.remove(it.next());
+        for (V v : known) {
+            boolean removed = test.remove(v);
             assertTrue("Map's values should still equal HashMap's", removed);
         }
         assertTrue("Map's values should still equal HashMap's", test.isEmpty());

Modified: commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/AbstractSortedMapTest.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/AbstractSortedMapTest.java?rev=1429890&r1=1429889&r2=1429890&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/AbstractSortedMapTest.java (original)
+++ commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/AbstractSortedMapTest.java Mon Jan  7 16:48:10 2013
@@ -21,6 +21,7 @@ import java.util.Arrays;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
+import java.util.Map.Entry;
 import java.util.SortedMap;
 import java.util.TreeMap;
 
@@ -218,8 +219,7 @@ public abstract class AbstractSortedMapT
         public TestHeadMap(AbstractMapTest<K, V> main) {
             super("SortedMap.HeadMap", main);
             Map<K, V> sm = main.makeFullMap();
-            for (Iterator<Map.Entry<K, V>> it = sm.entrySet().iterator(); it.hasNext();) {
-                Map.Entry<K, V> entry = it.next();
+            for (Entry<K, V> entry : sm.entrySet()) {
                 this.subSortedKeys.add(entry.getKey());
                 this.subSortedValues.add(entry.getValue());
             }
@@ -271,8 +271,7 @@ public abstract class AbstractSortedMapT
         public TestTailMap(AbstractMapTest<K, V> main) {
             super("SortedMap.TailMap", main);
             Map<K, V> sm = main.makeFullMap();
-            for (Iterator<Map.Entry<K, V>> it = sm.entrySet().iterator(); it.hasNext();) {
-                Map.Entry<K, V> entry = it.next();
+            for (Entry<K, V> entry : sm.entrySet()) {
                 this.subSortedKeys.add(entry.getKey());
                 this.subSortedValues.add(entry.getValue());
             }
@@ -325,8 +324,7 @@ public abstract class AbstractSortedMapT
         public TestSubMap(AbstractMapTest<K, V> main) {
             super("SortedMap.SubMap", main);
             Map<K, V> sm = main.makeFullMap();
-            for (Iterator<Map.Entry<K, V>> it = sm.entrySet().iterator(); it.hasNext();) {
-                Map.Entry<K, V> entry = it.next();
+            for (Entry<K, V> entry : sm.entrySet()) {
                 this.subSortedKeys.add(entry.getKey());
                 this.subSortedValues.add(entry.getValue());
             }

Modified: commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/CaseInsensitiveMapTest.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/CaseInsensitiveMapTest.java?rev=1429890&r1=1429889&r2=1429890&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/CaseInsensitiveMapTest.java (original)
+++ commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/CaseInsensitiveMapTest.java Mon Jan  7 16:48:10 2013
@@ -132,8 +132,8 @@ public class CaseInsensitiveMapTest<K, V
         };
 
         try {
-            for (int i = 0; i < locales.length; i++) {
-                Locale.setDefault(locales[i]);
+            for (Locale locale : locales) {
+                Locale.setDefault(locale);
                 for (int j = 0; j < data.length; j++) {
                     assertTrue("Test data corrupt: " + j, data[j][0].equalsIgnoreCase(data[j][1]));
                     CaseInsensitiveMap<String, String> map = new CaseInsensitiveMap<String, String>();



Mime
View raw message