From: Axel Howind Date: Wed, 28 Feb 2024 09:35:46 +0000 (+0000) Subject: use Map.computeIfAbsent() X-Git-Tag: REL_5_3_0~85 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=6b40b7f966de92beebadea9fec32732243b104ff;p=poi.git use Map.computeIfAbsent() git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1916034 13f79535-47bb-0310-9956-ffa450edef68 --- 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)); } }