use Map.computeIfAbsent()

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1916034 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Axel Howind 2024-02-28 09:35:46 +00:00
parent 2496ce5229
commit 6b40b7f966

View 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));
}
}