228 |
|
* java.util.Spliterator. |
229 |
|
*/ |
230 |
|
public static interface ConcurrentHashMapSpliterator<T> { |
231 |
< |
/** |
231 |
> |
/** |
232 |
|
* If possible, returns a new spliterator covering |
233 |
|
* approximately one half of the elements, which will not be |
234 |
|
* covered by this spliterator. Returns null if cannot be |
735 |
|
Node<K,V> c, Node<K,V> v) { |
736 |
|
return U.compareAndSwapObject(tab, ((long)i << ASHIFT) + ABASE, c, v); |
737 |
|
} |
738 |
< |
|
738 |
> |
|
739 |
|
static final <K,V> void setTabAt(Node<K,V>[] tab, int i, Node<K,V> v) { |
740 |
|
U.putOrderedObject(tab, ((long)i << ASHIFT) + ABASE, v); |
741 |
|
} |
742 |
< |
|
742 |
> |
|
743 |
|
/* ---------------- Fields -------------- */ |
744 |
|
|
745 |
|
/** |
2422 |
|
++hc; |
2423 |
|
} |
2424 |
|
} |
2425 |
< |
ln = (lc <= UNTREEIFY_THRESHOLD ? untreeify(lo) : |
2426 |
< |
(hc != 0) ? new TreeBin<K,V>(lo) : t); |
2427 |
< |
hn = (hc <= UNTREEIFY_THRESHOLD ? untreeify(hi) : |
2428 |
< |
(lc != 0) ? new TreeBin<K,V>(hi) : t); |
2425 |
> |
ln = (lc <= UNTREEIFY_THRESHOLD) ? untreeify(lo) : |
2426 |
> |
(hc != 0) ? new TreeBin<K,V>(lo) : t; |
2427 |
> |
hn = (hc <= UNTREEIFY_THRESHOLD) ? untreeify(hi) : |
2428 |
> |
(lc != 0) ? new TreeBin<K,V>(hi) : t; |
2429 |
|
} |
2430 |
|
else |
2431 |
|
ln = hn = null; |
2475 |
|
} |
2476 |
|
|
2477 |
|
/** |
2478 |
< |
* Returns a list on non-TreeNodes replacing those in given list |
2478 |
> |
* Returns a list on non-TreeNodes replacing those in given list. |
2479 |
|
*/ |
2480 |
|
static <K,V> Node<K,V> untreeify(Node<K,V> b) { |
2481 |
|
Node<K,V> hd = null, tl = null; |
2530 |
|
return p; |
2531 |
|
else if (pl == null && pr == null) |
2532 |
|
break; |
2533 |
< |
else if ((kc != null || |
2533 |
> |
else if ((kc != null || |
2534 |
|
(kc = comparableClassFor(k)) != null) && |
2535 |
|
(dir = compareComparables(kc, k, pk)) != 0) |
2536 |
|
p = (dir < 0) ? pl : pr; |
2537 |
|
else if (pl == null) |
2538 |
|
p = pr; |
2539 |
< |
else if (pr == null || |
2539 |
> |
else if (pr == null || |
2540 |
|
(q = pr.findTreeNode(h, k, kc)) == null) |
2541 |
|
p = pl; |
2542 |
|
else |
2613 |
|
} |
2614 |
|
|
2615 |
|
/** |
2616 |
< |
* Acquires write lock for tree restructuring |
2616 |
> |
* Acquires write lock for tree restructuring. |
2617 |
|
*/ |
2618 |
|
private final void lockRoot() { |
2619 |
|
if (!U.compareAndSwapInt(this, LOCKSTATE, 0, WRITER)) |
2621 |
|
} |
2622 |
|
|
2623 |
|
/** |
2624 |
< |
* Releases write lock for tree restructuring |
2624 |
> |
* Releases write lock for tree restructuring. |
2625 |
|
*/ |
2626 |
|
private final void unlockRoot() { |
2627 |
|
lockState = 0; |
2628 |
|
} |
2629 |
|
|
2630 |
|
/** |
2631 |
< |
* Possibly blocks awaiting root lock |
2631 |
> |
* Possibly blocks awaiting root lock. |
2632 |
|
*/ |
2633 |
|
private final void contendedLock() { |
2634 |
|
boolean waiting = false; |
2751 |
|
* that are accessible independently of lock. So instead we |
2752 |
|
* swap the tree linkages. |
2753 |
|
* |
2754 |
< |
* @return true if now too small so should be untreeified. |
2754 |
> |
* @return true if now too small, so should be untreeified |
2755 |
|
*/ |
2756 |
|
final boolean removeTreeNode(TreeNode<K,V> p) { |
2757 |
|
TreeNode<K,V> next = (TreeNode<K,V>)p.next; |
3034 |
|
} |
3035 |
|
} |
3036 |
|
} |
3037 |
+ |
|
3038 |
|
/** |
3039 |
|
* Recursive invariant check |
3040 |
|
*/ |
3146 |
|
|
3147 |
|
/** |
3148 |
|
* Base of key, value, and entry Iterators. Adds fields to |
3149 |
< |
* Traverser to support iterator.remove |
3149 |
> |
* Traverser to support iterator.remove. |
3150 |
|
*/ |
3151 |
|
static class BaseIterator<K,V> extends Traverser<K,V> { |
3152 |
|
final ConcurrentHashMapV8<K,V> map; |
3498 |
|
* of all (key, value) pairs |
3499 |
|
* @since 1.8 |
3500 |
|
*/ |
3501 |
< |
public double reduceToDoubleIn(long parallelismThreshold, |
3502 |
< |
ObjectByObjectToDouble<? super K, ? super V> transformer, |
3503 |
< |
double basis, |
3504 |
< |
DoubleByDoubleToDouble reducer) { |
3501 |
> |
public double reduceToDouble(long parallelismThreshold, |
3502 |
> |
ObjectByObjectToDouble<? super K, ? super V> transformer, |
3503 |
> |
double basis, |
3504 |
> |
DoubleByDoubleToDouble reducer) { |
3505 |
|
if (transformer == null || reducer == null) |
3506 |
|
throw new NullPointerException(); |
3507 |
|
return new MapReduceMappingsToDoubleTask<K,V> |
5986 |
|
} |
5987 |
|
|
5988 |
|
/** |
5989 |
< |
* Generates initial value for per-thread CounterHashCodes |
5989 |
> |
* Generates initial value for per-thread CounterHashCodes. |
5990 |
|
*/ |
5991 |
|
static final AtomicInteger counterHashCodeGenerator = new AtomicInteger(); |
5992 |
|
|