994 |
|
int hash = spread(key.hashCode()); |
995 |
|
int binCount = 0; |
996 |
|
for (Node<K,V>[] tab = table;;) { |
997 |
< |
Node<K,V> f; int n, i, fh; |
997 |
> |
Node<K,V> f; int n, i, fh; K fk; V fv; |
998 |
|
if (tab == null || (n = tab.length) == 0) |
999 |
|
tab = initTable(); |
1000 |
|
else if ((f = tabAt(tab, i = (n - 1) & hash)) == null) { |
1003 |
|
} |
1004 |
|
else if ((fh = f.hash) == MOVED) |
1005 |
|
tab = helpTransfer(tab, f); |
1006 |
+ |
else if (onlyIfAbsent && fh == hash && // check first node |
1007 |
+ |
((fk = f.key) == key || fk != null && key.equals(fk)) && |
1008 |
+ |
(fv = f.val) != null) |
1009 |
+ |
return fv; |
1010 |
|
else { |
1011 |
|
V oldVal = null; |
1012 |
|
synchronized (f) { |
1677 |
|
V val = null; |
1678 |
|
int binCount = 0; |
1679 |
|
for (Node<K,V>[] tab = table;;) { |
1680 |
< |
Node<K,V> f; int n, i, fh; |
1680 |
> |
Node<K,V> f; int n, i, fh; K fk; V fv; |
1681 |
|
if (tab == null || (n = tab.length) == 0) |
1682 |
|
tab = initTable(); |
1683 |
|
else if ((f = tabAt(tab, i = (n - 1) & h)) == null) { |
1699 |
|
} |
1700 |
|
else if ((fh = f.hash) == MOVED) |
1701 |
|
tab = helpTransfer(tab, f); |
1702 |
+ |
else if (fh == h && // check first node |
1703 |
+ |
((fk = f.key) == key || fk != null && key.equals(fk)) && |
1704 |
+ |
(fv = f.val) != null) |
1705 |
+ |
return fv; |
1706 |
|
else { |
1707 |
|
boolean added = false; |
1708 |
|
synchronized (f) { |