Skip to content

Commit

Permalink
Use forEach()
Browse files Browse the repository at this point in the history
  • Loading branch information
garydgregory committed Sep 3, 2024
1 parent adc8ece commit 3edbf44
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
4 changes: 1 addition & 3 deletions src/main/java/org/apache/commons/pool2/PoolUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -1351,9 +1351,7 @@ public static <K, V> Map<K, TimerTask> checkMinIdle(
throw new IllegalArgumentException(MSG_NULL_KEYS);
}
final Map<K, TimerTask> tasks = new HashMap<>(keys.size());
for (final K key : keys) {
tasks.put(key, checkMinIdle(keyedPool, key, minIdle, periodMillis));
}
keys.forEach(key -> tasks.put(key, checkMinIdle(keyedPool, key, minIdle, periodMillis)));
return tasks;
}

Expand Down
4 changes: 1 addition & 3 deletions src/test/java/org/apache/commons/pool2/WaiterFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,7 @@ public synchronized void reset() {
if (activeCounts.isEmpty()) {
return;
}
for (final K key : activeCounts.keySet()) {
activeCounts.put(key, ZERO);
}
activeCounts.keySet().forEach(key -> activeCounts.put(key, ZERO));
}

@Override
Expand Down

0 comments on commit 3edbf44

Please sign in to comment.