]> source.dussan.org Git - poi.git/commitdiff
use Map.computeIfAbsent()
authorAxel Howind <axh@apache.org>
Wed, 28 Feb 2024 09:35:46 +0000 (09:35 +0000)
committerAxel Howind <axh@apache.org>
Wed, 28 Feb 2024 09:35:46 +0000 (09:35 +0000)
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

index e35c80cacc312f05454c6b884966b84d87c9a4ad..4893d5e61bccd9338d74ffcc43bcb9b0200cf874 100644 (file)
@@ -27,11 +27,6 @@ public class BitFieldFactory {
     private static Map<Integer, BitField> 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));
     }
 }