ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/jsr166e/LongAdderTable.java
(Generate patch)

Comparing jsr166/src/jsr166e/LongAdderTable.java (file contents):
Revision 1.6 by jsr166, Sat Sep 10 01:44:53 2011 UTC vs.
Revision 1.7 by dl, Sun Oct 2 22:01:06 2011 UTC

# Line 53 | Line 53 | public class LongAdderTable<K> implement
53       * @return the adder associated with the key
54       */
55      public LongAdder install(K key) {
56 <        LongAdder a = map.get(key);
57 <        if (a == null) {
58 <            LongAdder r = new LongAdder();
59 <            if ((a = map.putIfAbsent(key, r)) == null)
60 <                a = r;
61 <        }
62 <        return a;
56 >        return map.computeIfAbsent(key, createAdder);
57      }
58  
59      /**
# Line 71 | Line 65 | public class LongAdderTable<K> implement
65       * @param x the value to add
66       */
67      public void add(K key, long x) {
68 <        LongAdder a = map.get(key);
75 <        if (a == null)
76 <            a = map.computeIfAbsent(key, createAdder);
77 <        a.add(x);
68 >        map.computeIfAbsent(key, createAdder).add(x);
69      }
70  
71      /**

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines