15 |
|
import java.util.AbstractMap; |
16 |
|
import java.util.Arrays; |
17 |
|
import java.util.Collection; |
18 |
– |
import java.util.Comparator; |
18 |
|
import java.util.ConcurrentModificationException; |
19 |
|
import java.util.Enumeration; |
20 |
|
import java.util.HashMap; |
114 |
|
* objects do not support method {@code setValue}. |
115 |
|
* |
116 |
|
* <ul> |
117 |
< |
* <li> forEach: Perform a given action on each element. |
117 |
> |
* <li>forEach: Perform a given action on each element. |
118 |
|
* A variant form applies a given transformation on each element |
119 |
< |
* before performing the action.</li> |
119 |
> |
* before performing the action. |
120 |
|
* |
121 |
< |
* <li> search: Return the first available non-null result of |
121 |
> |
* <li>search: Return the first available non-null result of |
122 |
|
* applying a given function on each element; skipping further |
123 |
< |
* search when a result is found.</li> |
123 |
> |
* search when a result is found. |
124 |
|
* |
125 |
< |
* <li> reduce: Accumulate each element. The supplied reduction |
125 |
> |
* <li>reduce: Accumulate each element. The supplied reduction |
126 |
|
* function cannot rely on ordering (more formally, it should be |
127 |
|
* both associative and commutative). There are five variants: |
128 |
|
* |
129 |
|
* <ul> |
130 |
|
* |
131 |
< |
* <li> Plain reductions. (There is not a form of this method for |
131 |
> |
* <li>Plain reductions. (There is not a form of this method for |
132 |
|
* (key, value) function arguments since there is no corresponding |
133 |
< |
* return type.)</li> |
133 |
> |
* return type.) |
134 |
|
* |
135 |
< |
* <li> Mapped reductions that accumulate the results of a given |
136 |
< |
* function applied to each element.</li> |
135 |
> |
* <li>Mapped reductions that accumulate the results of a given |
136 |
> |
* function applied to each element. |
137 |
|
* |
138 |
< |
* <li> Reductions to scalar doubles, longs, and ints, using a |
139 |
< |
* given basis value.</li> |
138 |
> |
* <li>Reductions to scalar doubles, longs, and ints, using a |
139 |
> |
* given basis value. |
140 |
|
* |
141 |
|
* </ul> |
143 |
– |
* </li> |
142 |
|
* </ul> |
143 |
|
* |
144 |
|
* <p>These bulk operations accept a {@code parallelismThreshold} |
487 |
|
* |
488 |
|
* Maintaining API and serialization compatibility with previous |
489 |
|
* versions of this class introduces several oddities. Mainly: We |
490 |
< |
* leave untouched but unused constructor arguments refering to |
490 |
> |
* leave untouched but unused constructor arguments referring to |
491 |
|
* concurrencyLevel. We accept a loadFactor constructor argument, |
492 |
|
* but apply it only to initial table capacity (which is the only |
493 |
|
* time that we can guarantee to honor it.) We also declare an |
636 |
|
this.next = next; |
637 |
|
} |
638 |
|
|
639 |
< |
public final K getKey() { return key; } |
640 |
< |
public final V getValue() { return val; } |
641 |
< |
public final int hashCode() { return key.hashCode() ^ val.hashCode(); } |
642 |
< |
public final String toString(){ return key + "=" + val; } |
639 |
> |
public final K getKey() { return key; } |
640 |
> |
public final V getValue() { return val; } |
641 |
> |
public final int hashCode() { return key.hashCode() ^ val.hashCode(); } |
642 |
> |
public final String toString() { return key + "=" + val; } |
643 |
|
public final V setValue(V value) { |
644 |
|
throw new UnsupportedOperationException(); |
645 |
|
} |
2415 |
|
return; |
2416 |
|
} |
2417 |
|
if (U.compareAndSwapInt(this, SIZECTL, sc = sizeCtl, sc - 1)) { |
2418 |
< |
if ((sc - 2) != resizeStamp(n)) |
2418 |
> |
if ((sc - 2) != resizeStamp(n) << RESIZE_STAMP_SHIFT) |
2419 |
|
return; |
2420 |
|
finishing = advance = true; |
2421 |
|
i = n; // recheck before commit |
2533 |
|
} |
2534 |
|
|
2535 |
|
/** |
2536 |
< |
* Returns a list on non-TreeNodes replacing those in given list. |
2536 |
> |
* Returns a list of non-TreeNodes replacing those in given list. |
2537 |
|
*/ |
2538 |
|
static <K,V> Node<K,V> untreeify(Node<K,V> b) { |
2539 |
|
Node<K,V> hd = null, tl = null; |
2577 |
|
final TreeNode<K,V> findTreeNode(int h, Object k, Class<?> kc) { |
2578 |
|
if (k != null) { |
2579 |
|
TreeNode<K,V> p = this; |
2580 |
< |
do { |
2580 |
> |
do { |
2581 |
|
int ph, dir; K pk; TreeNode<K,V> q; |
2582 |
|
TreeNode<K,V> pl = p.left, pr = p.right; |
2583 |
|
if ((ph = p.hash) > h) |
3026 |
|
|
3027 |
|
static <K,V> TreeNode<K,V> balanceDeletion(TreeNode<K,V> root, |
3028 |
|
TreeNode<K,V> x) { |
3029 |
< |
for (TreeNode<K,V> xp, xpl, xpr;;) { |
3029 |
> |
for (TreeNode<K,V> xp, xpl, xpr;;) { |
3030 |
|
if (x == null || x == root) |
3031 |
|
return root; |
3032 |
|
else if ((xp = x.parent) == null) { |