--- jsr166/src/jsr166e/LongAdderTable.java 2011/09/10 01:44:53 1.6 +++ jsr166/src/jsr166e/LongAdderTable.java 2011/10/02 22:01:06 1.7 @@ -53,13 +53,7 @@ public class LongAdderTable implement * @return the adder associated with the key */ public LongAdder install(K key) { - LongAdder a = map.get(key); - if (a == null) { - LongAdder r = new LongAdder(); - if ((a = map.putIfAbsent(key, r)) == null) - a = r; - } - return a; + return map.computeIfAbsent(key, createAdder); } /** @@ -71,10 +65,7 @@ public class LongAdderTable implement * @param x the value to add */ public void add(K key, long x) { - LongAdder a = map.get(key); - if (a == null) - a = map.computeIfAbsent(key, createAdder); - a.add(x); + map.computeIfAbsent(key, createAdder).add(x); } /**