Skip to content
Permalink
Browse files
Use enhanced for loops rather than iterators
  • Loading branch information
markt-asf committed Sep 2, 2021
1 parent faf335c commit 50fb3823750e52efcbb223374daca32daa0e9bdf
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
@@ -18,7 +18,6 @@

import java.io.Closeable;
import java.util.Collection;
import java.util.Iterator;
import java.util.NoSuchElementException;

/**
@@ -108,9 +107,8 @@ default void addObjects(final Collection<K> keys, final int count) throws Except
if (keys == null) {
throw new IllegalArgumentException(PoolUtils.MSG_NULL_KEYS);
}
final Iterator<K> iter = keys.iterator();
while (iter.hasNext()) {
addObjects(iter.next(), count);
for (final K key : keys) {
addObjects(key, count);
}
}

@@ -19,7 +19,6 @@
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.NoSuchElementException;
import java.util.Timer;
@@ -1351,9 +1350,7 @@ public static <K, V> Map<K, TimerTask> checkMinIdle(
throw new IllegalArgumentException(MSG_NULL_KEYS);
}
final Map<K, TimerTask> tasks = new HashMap<>(keys.size());
final Iterator<K> iter = keys.iterator();
while (iter.hasNext()) {
final K key = iter.next();
for (final K key : keys) {
final TimerTask task = checkMinIdle(keyedPool, key, minIdle, periodMillis);
tasks.put(key, task);
}

0 comments on commit 50fb382

Please sign in to comment.