ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/jdk8/java/util/concurrent/ConcurrentHashMap.java
(Generate patch)

Comparing jsr166/src/jdk8/java/util/concurrent/ConcurrentHashMap.java (file contents):
Revision 1.1 by jsr166, Sat Mar 26 06:22:49 2016 UTC vs.
Revision 1.5 by jsr166, Tue Oct 9 01:42:02 2018 UTC

# Line 1213 | Line 1213 | public class ConcurrentHashMap<K,V> exte
1213       */
1214      public KeySetView<K,V> keySet() {
1215          KeySetView<K,V> ks;
1216 <        return (ks = keySet) != null ? ks : (keySet = new KeySetView<K,V>(this, null));
1216 >        if ((ks = keySet) != null) return ks;
1217 >        return keySet = new KeySetView<K,V>(this, null);
1218      }
1219  
1220      /**
# Line 1236 | Line 1237 | public class ConcurrentHashMap<K,V> exte
1237       */
1238      public Collection<V> values() {
1239          ValuesView<K,V> vs;
1240 <        return (vs = values) != null ? vs : (values = new ValuesView<K,V>(this));
1240 >        if ((vs = values) != null) return vs;
1241 >        return values = new ValuesView<K,V>(this);
1242      }
1243  
1244      /**
# Line 1258 | Line 1260 | public class ConcurrentHashMap<K,V> exte
1260       */
1261      public Set<Map.Entry<K,V>> entrySet() {
1262          EntrySetView<K,V> es;
1263 <        return (es = entrySet) != null ? es : (entrySet = new EntrySetView<K,V>(this));
1263 >        if ((es = entrySet) != null) return es;
1264 >        return entrySet = new EntrySetView<K,V>(this);
1265      }
1266  
1267      /**
# Line 2517 | Line 2520 | public class ConcurrentHashMap<K,V> exte
2520                              setTabAt(tab, i, fwd);
2521                              advance = true;
2522                          }
2523 +                        else if (f instanceof ReservationNode)
2524 +                            throw new IllegalStateException("Recursive update");
2525                      }
2526                  }
2527              }
# Line 2529 | Line 2534 | public class ConcurrentHashMap<K,V> exte
2534       * A padded cell for distributing counts.  Adapted from LongAdder
2535       * and Striped64.  See their internal docs for explanation.
2536       */
2537 <    @jdk.internal.vm.annotation.Contended static final class CounterCell {
2537 >    @sun.misc.Contended static final class CounterCell {
2538          volatile long value;
2539          CounterCell(long x) { value = x; }
2540      }
# Line 3429 | Line 3434 | public class ConcurrentHashMap<K,V> exte
3434  
3435      static final class KeyIterator<K,V> extends BaseIterator<K,V>
3436          implements Iterator<K>, Enumeration<K> {
3437 <        KeyIterator(Node<K,V>[] tab, int index, int size, int limit,
3437 >        KeyIterator(Node<K,V>[] tab, int size, int index, int limit,
3438                      ConcurrentHashMap<K,V> map) {
3439 <            super(tab, index, size, limit, map);
3439 >            super(tab, size, index, limit, map);
3440          }
3441  
3442          public final K next() {
# Line 3449 | Line 3454 | public class ConcurrentHashMap<K,V> exte
3454  
3455      static final class ValueIterator<K,V> extends BaseIterator<K,V>
3456          implements Iterator<V>, Enumeration<V> {
3457 <        ValueIterator(Node<K,V>[] tab, int index, int size, int limit,
3457 >        ValueIterator(Node<K,V>[] tab, int size, int index, int limit,
3458                        ConcurrentHashMap<K,V> map) {
3459 <            super(tab, index, size, limit, map);
3459 >            super(tab, size, index, limit, map);
3460          }
3461  
3462          public final V next() {
# Line 3469 | Line 3474 | public class ConcurrentHashMap<K,V> exte
3474  
3475      static final class EntryIterator<K,V> extends BaseIterator<K,V>
3476          implements Iterator<Map.Entry<K,V>> {
3477 <        EntryIterator(Node<K,V>[] tab, int index, int size, int limit,
3477 >        EntryIterator(Node<K,V>[] tab, int size, int index, int limit,
3478                        ConcurrentHashMap<K,V> map) {
3479 <            super(tab, index, size, limit, map);
3479 >            super(tab, size, index, limit, map);
3480          }
3481  
3482          public final Map.Entry<K,V> next() {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines