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

Comparing jsr166/src/main/java/util/concurrent/ConcurrentHashMap.java (file contents):
Revision 1.289 by jsr166, Mon Mar 7 23:55:32 2016 UTC vs.
Revision 1.290 by jsr166, Tue Mar 8 00:27:35 2016 UTC

# Line 599 | Line 599 | public class ConcurrentHashMap<K,V> exte
599          volatile V val;
600          volatile Node<K,V> next;
601  
602 <        Node(int hash, K key, V val, Node<K,V> next) {
602 >        Node(int hash, K key, V val) {
603              this.hash = hash;
604              this.key = key;
605              this.val = val;
606 +        }
607 +
608 +        Node(int hash, K key, V val, Node<K,V> next) {
609 +            this(hash, key, val);
610              this.next = next;
611          }
612  
# Line 995 | Line 999 | public class ConcurrentHashMap<K,V> exte
999              if (tab == null || (n = tab.length) == 0)
1000                  tab = initTable();
1001              else if ((f = tabAt(tab, i = (n - 1) & hash)) == null) {
1002 <                if (casTabAt(tab, i, null,
999 <                             new Node<K,V>(hash, key, value, null)))
1002 >                if (casTabAt(tab, i, null, new Node<K,V>(hash, key, value)))
1003                      break;                   // no lock when adding to empty bin
1004              }
1005              else if ((fh = f.hash) == MOVED)
# Line 1019 | Line 1022 | public class ConcurrentHashMap<K,V> exte
1022                                  }
1023                                  Node<K,V> pred = e;
1024                                  if ((e = e.next) == null) {
1025 <                                    pred.next = new Node<K,V>(hash, key,
1023 <                                                              value, null);
1025 >                                    pred.next = new Node<K,V>(hash, key, value);
1026                                      break;
1027                                  }
1028                              }
# Line 1680 | Line 1682 | public class ConcurrentHashMap<K,V> exte
1682                          Node<K,V> node = null;
1683                          try {
1684                              if ((val = mappingFunction.apply(key)) != null)
1685 <                                node = new Node<K,V>(h, key, val, null);
1685 >                                node = new Node<K,V>(h, key, val);
1686                          } finally {
1687                              setTabAt(tab, i, node);
1688                          }
# Line 1711 | Line 1713 | public class ConcurrentHashMap<K,V> exte
1713                                          if (pred.next != null)
1714                                              throw new IllegalStateException("Recursive update");
1715                                          added = true;
1716 <                                        pred.next = new Node<K,V>(h, key, val, null);
1716 >                                        pred.next = new Node<K,V>(h, key, val);
1717                                      }
1718                                      break;
1719                                  }
# Line 1880 | Line 1882 | public class ConcurrentHashMap<K,V> exte
1882                          try {
1883                              if ((val = remappingFunction.apply(key, null)) != null) {
1884                                  delta = 1;
1885 <                                node = new Node<K,V>(h, key, val, null);
1885 >                                node = new Node<K,V>(h, key, val);
1886                              }
1887                          } finally {
1888                              setTabAt(tab, i, node);
# Line 1922 | Line 1924 | public class ConcurrentHashMap<K,V> exte
1924                                          if (pred.next != null)
1925                                              throw new IllegalStateException("Recursive update");
1926                                          delta = 1;
1927 <                                        pred.next =
1926 <                                            new Node<K,V>(h, key, val, null);
1927 >                                        pred.next = new Node<K,V>(h, key, val);
1928                                      }
1929                                      break;
1930                                  }
# Line 2001 | Line 2002 | public class ConcurrentHashMap<K,V> exte
2002              if (tab == null || (n = tab.length) == 0)
2003                  tab = initTable();
2004              else if ((f = tabAt(tab, i = (n - 1) & h)) == null) {
2005 <                if (casTabAt(tab, i, null, new Node<K,V>(h, key, value, null))) {
2005 >                if (casTabAt(tab, i, null, new Node<K,V>(h, key, value))) {
2006                      delta = 1;
2007                      val = value;
2008                      break;
# Line 2036 | Line 2037 | public class ConcurrentHashMap<K,V> exte
2037                                  if ((e = e.next) == null) {
2038                                      delta = 1;
2039                                      val = value;
2040 <                                    pred.next =
2040 <                                        new Node<K,V>(h, key, val, null);
2040 >                                    pred.next = new Node<K,V>(h, key, val);
2041                                      break;
2042                                  }
2043                              }
# Line 2198 | Line 2198 | public class ConcurrentHashMap<K,V> exte
2198      static final class ForwardingNode<K,V> extends Node<K,V> {
2199          final Node<K,V>[] nextTable;
2200          ForwardingNode(Node<K,V>[] tab) {
2201 <            super(MOVED, null, null, null);
2201 >            super(MOVED, null, null);
2202              this.nextTable = tab;
2203          }
2204  
# Line 2234 | Line 2234 | public class ConcurrentHashMap<K,V> exte
2234       */
2235      static final class ReservationNode<K,V> extends Node<K,V> {
2236          ReservationNode() {
2237 <            super(RESERVED, null, null, null);
2237 >            super(RESERVED, null, null);
2238          }
2239  
2240          Node<K,V> find(int h, Object k) {
# Line 2666 | Line 2666 | public class ConcurrentHashMap<K,V> exte
2666      static <K,V> Node<K,V> untreeify(Node<K,V> b) {
2667          Node<K,V> hd = null, tl = null;
2668          for (Node<K,V> q = b; q != null; q = q.next) {
2669 <            Node<K,V> p = new Node<K,V>(q.hash, q.key, q.val, null);
2669 >            Node<K,V> p = new Node<K,V>(q.hash, q.key, q.val);
2670              if (tl == null)
2671                  hd = p;
2672              else
# Line 2772 | Line 2772 | public class ConcurrentHashMap<K,V> exte
2772           * Creates bin with initial set of nodes headed by b.
2773           */
2774          TreeBin(TreeNode<K,V> b) {
2775 <            super(TREEBIN, null, null, null);
2775 >            super(TREEBIN, null, null);
2776              this.first = b;
2777              TreeNode<K,V> r = null;
2778              for (TreeNode<K,V> x = b, next; x != null; x = next) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines