This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch POOL_2_X
in repository https://gitbox.apache.org/repos/asf/commons-pool.git


The following commit(s) were added to refs/heads/POOL_2_X by this push:
     new 3edbf44b Use forEach()
3edbf44b is described below

commit 3edbf44baebf51476b80120de0f6d4b747079d63
Author: Gary Gregory <garydgreg...@gmail.com>
AuthorDate: Tue Sep 3 08:10:45 2024 -0400

    Use forEach()
---
 src/main/java/org/apache/commons/pool2/PoolUtils.java     | 4 +---
 src/test/java/org/apache/commons/pool2/WaiterFactory.java | 4 +---
 2 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/src/main/java/org/apache/commons/pool2/PoolUtils.java 
b/src/main/java/org/apache/commons/pool2/PoolUtils.java
index fe3c3f66..49de3c6e 100644
--- a/src/main/java/org/apache/commons/pool2/PoolUtils.java
+++ b/src/main/java/org/apache/commons/pool2/PoolUtils.java
@@ -1351,9 +1351,7 @@ public final class PoolUtils {
             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;
     }
 
diff --git a/src/test/java/org/apache/commons/pool2/WaiterFactory.java 
b/src/test/java/org/apache/commons/pool2/WaiterFactory.java
index fdfd4c8a..4f189726 100644
--- a/src/test/java/org/apache/commons/pool2/WaiterFactory.java
+++ b/src/test/java/org/apache/commons/pool2/WaiterFactory.java
@@ -188,9 +188,7 @@ public class WaiterFactory<K> implements 
PooledObjectFactory<Waiter>, KeyedPoole
         if (activeCounts.isEmpty()) {
             return;
         }
-        for (final K key : activeCounts.keySet()) {
-            activeCounts.put(key, ZERO);
-        }
+        activeCounts.keySet().forEach(key -> activeCounts.put(key, ZERO));
     }
 
     @Override

Reply via email to