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 |
|
|
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) |
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 |
|
} |
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 |
|
} |
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 |
|
} |
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); |
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 |
|
} |
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; |
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 |
|
} |
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 |
|
|
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) { |
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 |
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) { |