Skip to content

Commit

Permalink
use Map.computeIfAbsent()
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1916034 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
Axel Howind committed Feb 28, 2024
1 parent 2496ce5 commit 6b40b7f
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions poi/src/main/java/org/apache/poi/util/BitFieldFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
}

0 comments on commit 6b40b7f

Please sign in to comment.