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

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


The following commit(s) were added to refs/heads/master by this push:
     new c5934eeb Use Map#computeIfPresent() instead of manually operating on 
the map
c5934eeb is described below

commit c5934eeb7941ffaa3c56f11ed74baa614bc80a33
Author: Gary Gregory <garydgreg...@gmail.com>
AuthorDate: Sat Jul 8 08:59:58 2023 -0400

    Use Map#computeIfPresent() instead of manually operating on the map
---
 src/test/java/org/apache/commons/pool2/WaiterFactory.java | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/test/java/org/apache/commons/pool2/WaiterFactory.java 
b/src/test/java/org/apache/commons/pool2/WaiterFactory.java
index b3c6a8d3..8d441f1a 100644
--- a/src/test/java/org/apache/commons/pool2/WaiterFactory.java
+++ b/src/test/java/org/apache/commons/pool2/WaiterFactory.java
@@ -113,11 +113,10 @@ public class WaiterFactory<K> implements 
PooledObjectFactory<Waiter, IllegalStat
     }
 
     @Override
-    public void destroyObject(final K key,final PooledObject<Waiter> obj) {
+    public void destroyObject(final K key, final PooledObject<Waiter> obj) {
         destroyObject(obj);
         synchronized (this) {
-            final Integer count = activeCounts.get(key);
-            activeCounts.put(key, Integer.valueOf(count.intValue() - 1));
+            activeCounts.computeIfPresent(key, (k, v) -> 
Integer.valueOf(v.intValue() - 1));
         }
     }
 

Reply via email to