2898 |
|
} |
2899 |
|
|
2900 |
|
/** |
2901 |
< |
* Returns a partionable iterator of the keys in this map. |
2901 |
> |
* Returns a partitionable iterator of the keys in this map. |
2902 |
|
* |
2903 |
< |
* @return a partionable iterator of the keys in this map |
2903 |
> |
* @return a partitionable iterator of the keys in this map |
2904 |
|
*/ |
2905 |
|
public Spliterator<K> keySpliterator() { |
2906 |
|
return new KeyIterator<K,V>(this); |
2907 |
|
} |
2908 |
|
|
2909 |
|
/** |
2910 |
< |
* Returns a partionable iterator of the values in this map. |
2910 |
> |
* Returns a partitionable iterator of the values in this map. |
2911 |
|
* |
2912 |
< |
* @return a partionable iterator of the values in this map |
2912 |
> |
* @return a partitionable iterator of the values in this map |
2913 |
|
*/ |
2914 |
|
public Spliterator<V> valueSpliterator() { |
2915 |
|
return new ValueIterator<K,V>(this); |
2916 |
|
} |
2917 |
|
|
2918 |
|
/** |
2919 |
< |
* Returns a partionable iterator of the entries in this map. |
2919 |
> |
* Returns a partitionable iterator of the entries in this map. |
2920 |
|
* |
2921 |
< |
* @return a partionable iterator of the entries in this map |
2921 |
> |
* @return a partitionable iterator of the entries in this map |
2922 |
|
*/ |
2923 |
|
public Spliterator<Map.Entry<K,V>> entrySpliterator() { |
2924 |
|
return new EntryIterator<K,V>(this); |
3518 |
|
|
3519 |
|
/** |
3520 |
|
* An extended view of a ConcurrentHashMap supporting bulk |
3521 |
< |
* parallel operations. These operations are designed to be be |
3521 |
> |
* parallel operations. These operations are designed to be |
3522 |
|
* safely, and often sensibly, applied even with maps that are |
3523 |
|
* being concurrently updated by other threads; for example, when |
3524 |
|
* computing a snapshot summary of the values in a shared |
3636 |
|
* |
3637 |
|
* @param action the action |
3638 |
|
*/ |
3639 |
< |
public void forEach(BiAction<K,V> action) { |
3639 |
> |
public void forEach(BiAction<K,V> action) { |
3640 |
|
fjp.invoke(ForkJoinTasks.forEach |
3641 |
|
(ConcurrentHashMapV8.this, action)); |
3642 |
|
} |
3650 |
|
* which case the action is not applied). |
3651 |
|
* @param action the action |
3652 |
|
*/ |
3653 |
< |
public <U> void forEach(BiFun<? super K, ? super V, ? extends U> transformer, |
3653 |
> |
public <U> void forEach(BiFun<? super K, ? super V, ? extends U> transformer, |
3654 |
|
Action<U> action) { |
3655 |
|
fjp.invoke(ForkJoinTasks.forEach |
3656 |
|
(ConcurrentHashMapV8.this, transformer, action)); |
3754 |
|
* |
3755 |
|
* @param action the action |
3756 |
|
*/ |
3757 |
< |
public void forEachKey(Action<K> action) { |
3757 |
> |
public void forEachKey(Action<K> action) { |
3758 |
|
fjp.invoke(ForkJoinTasks.forEachKey |
3759 |
|
(ConcurrentHashMapV8.this, action)); |
3760 |
|
} |
3768 |
|
* which case the action is not applied). |
3769 |
|
* @param action the action |
3770 |
|
*/ |
3771 |
< |
public <U> void forEachKey(Fun<? super K, ? extends U> transformer, |
3771 |
> |
public <U> void forEachKey(Fun<? super K, ? extends U> transformer, |
3772 |
|
Action<U> action) { |
3773 |
|
fjp.invoke(ForkJoinTasks.forEachKey |
3774 |
|
(ConcurrentHashMapV8.this, transformer, action)); |
3884 |
|
* |
3885 |
|
* @param action the action |
3886 |
|
*/ |
3887 |
< |
public void forEachValue(Action<V> action) { |
3887 |
> |
public void forEachValue(Action<V> action) { |
3888 |
|
fjp.invoke(ForkJoinTasks.forEachValue |
3889 |
|
(ConcurrentHashMapV8.this, action)); |
3890 |
|
} |
3897 |
|
* for an element, or null of there is no transformation (in |
3898 |
|
* which case the action is not applied). |
3899 |
|
*/ |
3900 |
< |
public <U> void forEachValue(Fun<? super V, ? extends U> transformer, |
3900 |
> |
public <U> void forEachValue(Fun<? super V, ? extends U> transformer, |
3901 |
|
Action<U> action) { |
3902 |
|
fjp.invoke(ForkJoinTasks.forEachValue |
3903 |
|
(ConcurrentHashMapV8.this, transformer, action)); |
4013 |
|
* |
4014 |
|
* @param action the action |
4015 |
|
*/ |
4016 |
< |
public void forEachEntry(Action<Map.Entry<K,V>> action) { |
4016 |
> |
public void forEachEntry(Action<Map.Entry<K,V>> action) { |
4017 |
|
fjp.invoke(ForkJoinTasks.forEachEntry |
4018 |
|
(ConcurrentHashMapV8.this, action)); |
4019 |
|
} |
4027 |
|
* which case the action is not applied). |
4028 |
|
* @param action the action |
4029 |
|
*/ |
4030 |
< |
public <U> void forEachEntry(Fun<Map.Entry<K,V>, ? extends U> transformer, |
4030 |
> |
public <U> void forEachEntry(Fun<Map.Entry<K,V>, ? extends U> transformer, |
4031 |
|
Action<U> action) { |
4032 |
|
fjp.invoke(ForkJoinTasks.forEachEntry |
4033 |
|
(ConcurrentHashMapV8.this, transformer, action)); |
4159 |
|
* @param action the action |
4160 |
|
* @return the task |
4161 |
|
*/ |
4162 |
< |
public static <K,V> ForkJoinTask<Void> forEach |
4162 |
> |
public static <K,V> ForkJoinTask<Void> forEach |
4163 |
|
(ConcurrentHashMapV8<K,V> map, |
4164 |
|
BiAction<K,V> action) { |
4165 |
|
if (action == null) throw new NullPointerException(); |
4177 |
|
* @param action the action |
4178 |
|
* @return the task |
4179 |
|
*/ |
4180 |
< |
public static <K,V,U> ForkJoinTask<Void> forEach |
4180 |
> |
public static <K,V,U> ForkJoinTask<Void> forEach |
4181 |
|
(ConcurrentHashMapV8<K,V> map, |
4182 |
|
BiFun<? super K, ? super V, ? extends U> transformer, |
4183 |
|
Action<U> action) { |
4310 |
|
* @param action the action |
4311 |
|
* @return the task |
4312 |
|
*/ |
4313 |
< |
public static <K,V> ForkJoinTask<Void> forEachKey |
4313 |
> |
public static <K,V> ForkJoinTask<Void> forEachKey |
4314 |
|
(ConcurrentHashMapV8<K,V> map, |
4315 |
|
Action<K> action) { |
4316 |
|
if (action == null) throw new NullPointerException(); |
4328 |
|
* @param action the action |
4329 |
|
* @return the task |
4330 |
|
*/ |
4331 |
< |
public static <K,V,U> ForkJoinTask<Void> forEachKey |
4331 |
> |
public static <K,V,U> ForkJoinTask<Void> forEachKey |
4332 |
|
(ConcurrentHashMapV8<K,V> map, |
4333 |
|
Fun<? super K, ? extends U> transformer, |
4334 |
|
Action<U> action) { |
4477 |
|
* @param map the map |
4478 |
|
* @param action the action |
4479 |
|
*/ |
4480 |
< |
public static <K,V> ForkJoinTask<Void> forEachValue |
4480 |
> |
public static <K,V> ForkJoinTask<Void> forEachValue |
4481 |
|
(ConcurrentHashMapV8<K,V> map, |
4482 |
|
Action<V> action) { |
4483 |
|
if (action == null) throw new NullPointerException(); |
4494 |
|
* which case the action is not applied). |
4495 |
|
* @param action the action |
4496 |
|
*/ |
4497 |
< |
public static <K,V,U> ForkJoinTask<Void> forEachValue |
4497 |
> |
public static <K,V,U> ForkJoinTask<Void> forEachValue |
4498 |
|
(ConcurrentHashMapV8<K,V> map, |
4499 |
|
Fun<? super V, ? extends U> transformer, |
4500 |
|
Action<U> action) { |
4645 |
|
* @param map the map |
4646 |
|
* @param action the action |
4647 |
|
*/ |
4648 |
< |
public static <K,V> ForkJoinTask<Void> forEachEntry |
4648 |
> |
public static <K,V> ForkJoinTask<Void> forEachEntry |
4649 |
|
(ConcurrentHashMapV8<K,V> map, |
4650 |
|
Action<Map.Entry<K,V>> action) { |
4651 |
|
if (action == null) throw new NullPointerException(); |
4662 |
|
* which case the action is not applied). |
4663 |
|
* @param action the action |
4664 |
|
*/ |
4665 |
< |
public static <K,V,U> ForkJoinTask<Void> forEachEntry |
4665 |
> |
public static <K,V,U> ForkJoinTask<Void> forEachEntry |
4666 |
|
(ConcurrentHashMapV8<K,V> map, |
4667 |
|
Fun<Map.Entry<K,V>, ? extends U> transformer, |
4668 |
|
Action<U> action) { |
4811 |
|
|
4812 |
|
/** |
4813 |
|
* Base for FJ tasks for bulk operations. This adds a variant of |
4814 |
< |
* CountedCompleters and some split and merge bookeeping to |
4814 |
> |
* CountedCompleters and some split and merge bookkeeping to |
4815 |
|
* iterator functionality. The forEach and reduce methods are |
4816 |
|
* similar to those illustrated in CountedCompleter documentation, |
4817 |
|
* except that bottom-up reduction completions perform them within |
4877 |
|
try { |
4878 |
|
compute(); |
4879 |
|
} |
4880 |
< |
catch(Throwable ex) { |
4880 |
> |
catch (Throwable ex) { |
4881 |
|
tryAbortComputation(ex); |
4882 |
|
} |
4883 |
|
return false; |
4904 |
|
if (b < 0) { |
4905 |
|
long n = map.counter.sum(); |
4906 |
|
int sp = getPool().getParallelism() << 3; // slack of 8 |
4907 |
< |
b = batch = (n <= 0L)? 0 : (n < (long)sp) ? (int)n : sp; |
4907 |
> |
b = batch = (n <= 0L) ? 0 : (n < (long)sp) ? (int)n : sp; |
4908 |
|
} |
4909 |
|
return b; |
4910 |
|
} |