Simplify: entries cannot be null in a ConcurrentHashMap.
@@ -1197,16 +1197,12 @@ public class GenericKeyedObjectPool<K, T, E extends Exception> extends BaseGener
public Map<String, Integer> getNumActivePerKey() {
final HashMap<String, Integer> result = new HashMap<>();
- poolMap.entrySet().forEach(entry -> {
- if (entry != null) {
- final K key = entry.getKey();
- final ObjectDeque<T> objectDequeue = entry.getValue();
+ poolMap.forEach((key, objectDequeue) -> {
if (key != null && objectDequeue != null) {
result.put(key.toString(), Integer.valueOf(
objectDequeue.getAllObjects().size() -
objectDequeue.getIdleObjects().size()));
}
- }
});
return result;
}
