commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject svn commit: r1429890 [2/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
Modified: commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/LRUMapTest.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/LRUMapTest.java?rev=1429890&r1=1429889&r2=1429890&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/LRUMapTest.java
(original)
+++ commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/LRUMapTest.java
Mon Jan  7 16:48:10 2013
@@ -529,27 +529,27 @@ public class LRUMapTest<K, V> extends Ab
             };
         }
 
-        for (int i = 0; i < threads.length; ++i) {
-            synchronized (threads[i]) {
-                threads[i].start();
-                threads[i].wait();
+        for (Thread thread : threads) {
+            synchronized (thread) {
+                thread.start();
+                thread.wait();
             }
         }
 
-        for (int i = 0; i < threads.length; ++i) {
-            synchronized (threads[i]) {
-                threads[i].notifyAll();
+        for (Thread thread : threads) {
+            synchronized (thread) {
+                thread.notifyAll();
             }
         }
 
         Thread.sleep(1000);
 
-        for (int i = 0; i < threads.length; ++i) {
-            threads[i].interrupt();
+        for (Thread thread : threads) {
+            thread.interrupt();
         }
-        for (int i = 0; i < threads.length; ++i) {
-            synchronized (threads[i]) {
-                threads[i].join();
+        for (Thread thread : threads) {
+            synchronized (thread) {
+                thread.join();
             }
         }
 
@@ -612,27 +612,27 @@ public class LRUMapTest<K, V> extends Ab
             };
         }
 
-        for (int i = 0; i < threads.length; ++i) {
-            synchronized (threads[i]) {
-                threads[i].start();
-                threads[i].wait();
+        for (Thread thread : threads) {
+            synchronized (thread) {
+                thread.start();
+                thread.wait();
             }
         }
 
-        for (int i = 0; i < threads.length; ++i) {
-            synchronized (threads[i]) {
-                threads[i].notifyAll();
+        for (Thread thread : threads) {
+            synchronized (thread) {
+                thread.notifyAll();
             }
         }
 
         Thread.sleep(1000);
 
-        for (int i = 0; i < threads.length; ++i) {
-            threads[i].interrupt();
+        for (Thread thread : threads) {
+            thread.interrupt();
         }
-        for (int i = 0; i < threads.length; ++i) {
-            synchronized (threads[i]) {
-                threads[i].join();
+        for (Thread thread : threads) {
+            synchronized (thread) {
+                thread.join();
             }
         }
 
@@ -695,27 +695,27 @@ public class LRUMapTest<K, V> extends Ab
             };
         }
 
-        for (int i = 0; i < threads.length; ++i) {
-            synchronized (threads[i]) {
-                threads[i].start();
-                threads[i].wait();
+        for (Thread thread : threads) {
+            synchronized (thread) {
+                thread.start();
+                thread.wait();
             }
         }
 
-        for (int i = 0; i < threads.length; ++i) {
-            synchronized (threads[i]) {
-                threads[i].notifyAll();
+        for (Thread thread : threads) {
+            synchronized (thread) {
+                thread.notifyAll();
             }
         }
 
         Thread.sleep(1000);
 
-        for (int i = 0; i < threads.length; ++i) {
-            threads[i].interrupt();
+        for (Thread thread : threads) {
+            thread.interrupt();
         }
-        for (int i = 0; i < threads.length; ++i) {
-            synchronized (threads[i]) {
-                threads[i].join();
+        for (Thread thread : threads) {
+            synchronized (thread) {
+                thread.join();
             }
         }
 
@@ -777,27 +777,27 @@ public class LRUMapTest<K, V> extends Ab
             };
         }
 
-        for (int i = 0; i < threads.length; ++i) {
-            synchronized (threads[i]) {
-                threads[i].start();
-                threads[i].wait();
+        for (Thread thread : threads) {
+            synchronized (thread) {
+                thread.start();
+                thread.wait();
             }
         }
 
-        for (int i = 0; i < threads.length; ++i) {
-            synchronized (threads[i]) {
-                threads[i].notifyAll();
+        for (Thread thread : threads) {
+            synchronized (thread) {
+                thread.notifyAll();
             }
         }
 
         Thread.sleep(1000);
 
-        for (int i = 0; i < threads.length; ++i) {
-            threads[i].interrupt();
+        for (Thread thread : threads) {
+            thread.interrupt();
         }
-        for (int i = 0; i < threads.length; ++i) {
-            synchronized (threads[i]) {
-                threads[i].join();
+        for (Thread thread : threads) {
+            synchronized (thread) {
+                thread.join();
             }
         }
 

Modified: commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/MultiKeyMapTest.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/MultiKeyMapTest.java?rev=1429890&r1=1429889&r2=1429890&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/MultiKeyMapTest.java
(original)
+++ commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/MultiKeyMapTest.java
Mon Jan  7 16:48:10 2013
@@ -196,9 +196,7 @@ public class MultiKeyMapTest<K, V> exten
         MultiKeyMap<K, V> multimap = getMap();
         MultiKey<K>[] keys = getMultiKeyKeys();
 
-        for (int i = 0; i < keys.length; i++) {
-            MultiKey<K> key = keys[i];
-
+        for (MultiKey<K> key : keys) {
             switch (key.size()) {
                 case 2:
                 assertEquals(true, multimap.containsKey(key.getKey(0), key.getKey(1)));

Modified: commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/MultiValueMapTest.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/MultiValueMapTest.java?rev=1429890&r1=1429889&r2=1429890&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/MultiValueMapTest.java
(original)
+++ commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/MultiValueMapTest.java
Mon Jan  7 16:48:10 2013
@@ -407,8 +407,7 @@ public class MultiValueMapTest<K, V> ext
         Map<?,?> map = (Map<?,?>) makeObject();
         Map<?,?> map2 = (Map<?,?>) readExternalFormFromDisk(getCanonicalFullCollectionName(map));
         assertEquals("Map is the right size", map.size(), map2.size());
-        for (Iterator<?> it = map.keySet().iterator(); it.hasNext();) {
-            Object key = it.next();
+        for (Object key : map.keySet()) {
             assertEquals( "Map had inequal elements", map.get(key), map2.get(key) );
             map2.remove(key);
         }

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

Modified: commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/set/TransformedSortedSetTest.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/set/TransformedSortedSetTest.java?rev=1429890&r1=1429889&r2=1429890&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/set/TransformedSortedSetTest.java
(original)
+++ commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/set/TransformedSortedSetTest.java
Mon Jan  7 16:48:10 2013
@@ -78,13 +78,13 @@ public class TransformedSortedSetTest<E>
     public void testTransformedSet_decorateTransform() {
         Set<Object> originalSet = new TreeSet<Object>();
         Object[] els = new Object[] {"1", "3", "5", "7", "2", "4", "6"};
-        for (int i = 0; i < els.length; i++) {
-            originalSet.add(els[i]);
+        for (Object el : els) {
+            originalSet.add(el);
         }
         Set<?> set = TransformedSortedSet.transformedSet(originalSet, TransformedCollectionTest.STRING_TO_INTEGER_TRANSFORMER);
         assertEquals(els.length, set.size());
-        for (int i = 0; i < els.length; i++) {
-            assertEquals(true, set.contains(new Integer((String) els[i])));
+        for (Object el : els) {
+            assertEquals(true, set.contains(new Integer((String) el)));
         }
         
         assertEquals(true, set.remove(new Integer((String) els[0])));



Mime
View raw message