From 6b40b7f966de92beebadea9fec32732243b104ff Mon Sep 17 00:00:00 2001 From: Axel Howind Date: Wed, 28 Feb 2024 09:35:46 +0000 Subject: [PATCH] use Map.computeIfAbsent() git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1916034 13f79535-47bb-0310-9956-ffa450edef68 --- poi/src/main/java/org/apache/poi/util/BitFieldFactory.java | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/poi/src/main/java/org/apache/poi/util/BitFieldFactory.java b/poi/src/main/java/org/apache/poi/util/BitFieldFactory.java index e35c80cacc..4893d5e61b 100644 --- a/poi/src/main/java/org/apache/poi/util/BitFieldFactory.java +++ b/poi/src/main/java/org/apache/poi/util/BitFieldFactory.java @@ -27,11 +27,6 @@ public class BitFieldFactory { private static Map instances = new HashMap<>(); public static BitField getInstance(int mask) { - BitField f = instances.get(Integer.valueOf(mask)); - if (f == null) { - f = new BitField(mask); - instances.put(Integer.valueOf(mask), f); - } - return f; + return instances.computeIfAbsent(mask, k -> new BitField(mask)); } } -- 2.39.5