Skip to content

Commit 3edbf44

Browse files
committed
Use forEach()
1 parent adc8ece commit 3edbf44

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

src/main/java/org/apache/commons/pool2/PoolUtils.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1351,9 +1351,7 @@ public static <K, V> Map<K, TimerTask> checkMinIdle(
13511351
throw new IllegalArgumentException(MSG_NULL_KEYS);
13521352
}
13531353
final Map<K, TimerTask> tasks = new HashMap<>(keys.size());
1354-
for (final K key : keys) {
1355-
tasks.put(key, checkMinIdle(keyedPool, key, minIdle, periodMillis));
1356-
}
1354+
keys.forEach(key -> tasks.put(key, checkMinIdle(keyedPool, key, minIdle, periodMillis)));
13571355
return tasks;
13581356
}
13591357

src/test/java/org/apache/commons/pool2/WaiterFactory.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -188,9 +188,7 @@ public synchronized void reset() {
188188
if (activeCounts.isEmpty()) {
189189
return;
190190
}
191-
for (final K key : activeCounts.keySet()) {
192-
activeCounts.put(key, ZERO);
193-
}
191+
activeCounts.keySet().forEach(key -> activeCounts.put(key, ZERO));
194192
}
195193

196194
@Override

0 commit comments

Comments
 (0)