commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject svn commit: r1021833 - /commons/proper/pool/trunk/src/java/org/apache/commons/pool/PoolUtils.java
Date Tue, 12 Oct 2010 16:58:00 GMT
Author: ggregory
Date: Tue Oct 12 16:58:00 2010
New Revision: 1021833

URL: http://svn.apache.org/viewvc?rev=1021833&view=rev
Log:
Use Java 5's enhanced for loops (with Generics)

Modified:
    commons/proper/pool/trunk/src/java/org/apache/commons/pool/PoolUtils.java

Modified: commons/proper/pool/trunk/src/java/org/apache/commons/pool/PoolUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/java/org/apache/commons/pool/PoolUtils.java?rev=1021833&r1=1021832&r2=1021833&view=diff
==============================================================================
--- commons/proper/pool/trunk/src/java/org/apache/commons/pool/PoolUtils.java (original)
+++ commons/proper/pool/trunk/src/java/org/apache/commons/pool/PoolUtils.java Tue Oct 12 16:58:00
2010
@@ -271,12 +271,9 @@ public final class PoolUtils {
             throw new IllegalArgumentException("keys must not be null.");
         }
         final Map<K,TimerTask> tasks = new HashMap<K,TimerTask>(keys.size());
-        final Iterator<K> iter = keys.iterator();
-        while (iter.hasNext()) {
-            final K key = iter.next();
-            final TimerTask task = checkMinIdle(keyedPool, key, minIdle, period);
-            tasks.put(key, task);
-        }
+        for (K key : keys) {
+            tasks.put(key, checkMinIdle(keyedPool, key, minIdle, period));            
+        } 
         return tasks;
     }
 
@@ -339,9 +336,8 @@ public final class PoolUtils {
         if (keys == null) {
             throw new IllegalArgumentException("keys must not be null.");
         }
-        final Iterator<K> iter = keys.iterator();
-        while (iter.hasNext()) {
-            prefill(keyedPool, iter.next(), count);
+        for (K key : keys) {
+            prefill(keyedPool, key, count);
         }
     }
 



Mime
View raw message