40 |
|
* interoperable with {@code Hashtable} in programs that rely on its |
41 |
|
* thread safety but not on its synchronization details. |
42 |
|
* |
43 |
< |
* <p> Retrieval operations (including {@code get}) generally do not |
43 |
> |
* <p>Retrieval operations (including {@code get}) generally do not |
44 |
|
* block, so may overlap with update operations (including {@code put} |
45 |
|
* and {@code remove}). Retrievals reflect the results of the most |
46 |
|
* recently <em>completed</em> update operations holding upon their |
61 |
|
* that may be adequate for monitoring or estimation purposes, but not |
62 |
|
* for program control. |
63 |
|
* |
64 |
< |
* <p> The table is dynamically expanded when there are too many |
64 |
> |
* <p>The table is dynamically expanded when there are too many |
65 |
|
* collisions (i.e., keys that have distinct hash codes but fall into |
66 |
|
* the same slot modulo the table size), with the expected average |
67 |
|
* effect of maintaining roughly two bins per mapping (corresponding |
82 |
|
* {@code hashCode()} is a sure way to slow down performance of any |
83 |
|
* hash table. |
84 |
|
* |
85 |
< |
* <p> A {@link Set} projection of a ConcurrentHashMapV8 may be created |
85 |
> |
* <p>A {@link Set} projection of a ConcurrentHashMapV8 may be created |
86 |
|
* (using {@link #newKeySet()} or {@link #newKeySet(int)}), or viewed |
87 |
|
* (using {@link #keySet(Object)} when only keys are of interest, and the |
88 |
|
* mapped values are (perhaps transiently) not used or all take the |
89 |
|
* same mapping value. |
90 |
|
* |
91 |
< |
* <p> A ConcurrentHashMapV8 can be used as scalable frequency map (a |
91 |
> |
* <p>A ConcurrentHashMapV8 can be used as scalable frequency map (a |
92 |
|
* form of histogram or multiset) by using {@link LongAdder} values |
93 |
|
* and initializing via {@link #computeIfAbsent}. For example, to add |
94 |
|
* a count to a {@code ConcurrentHashMapV8<String,LongAdder> freqs}, you |
99 |
|
* <em>optional</em> methods of the {@link Map} and {@link Iterator} |
100 |
|
* interfaces. |
101 |
|
* |
102 |
< |
* <p> Like {@link Hashtable} but unlike {@link HashMap}, this class |
102 |
> |
* <p>Like {@link Hashtable} but unlike {@link HashMap}, this class |
103 |
|
* does <em>not</em> allow {@code null} to be used as a key or value. |
104 |
|
* |
105 |
|
* <p>ConcurrentHashMapV8s support parallel operations using the {@link |
184 |
|
* arguments can be supplied using {@code new |
185 |
|
* AbstractMap.SimpleEntry(k,v)}. |
186 |
|
* |
187 |
< |
* <p> Bulk operations may complete abruptly, throwing an |
187 |
> |
* <p>Bulk operations may complete abruptly, throwing an |
188 |
|
* exception encountered in the application of a supplied |
189 |
|
* function. Bear in mind when handling such exceptions that other |
190 |
|
* concurrently executing functions could also have thrown |
199 |
|
* Similarly, parallelization may not lead to much actual parallelism |
200 |
|
* if all processors are busy performing unrelated tasks. |
201 |
|
* |
202 |
< |
* <p> All arguments to all task methods must be non-null. |
202 |
> |
* <p>All arguments to all task methods must be non-null. |
203 |
|
* |
204 |
|
* <p><em>jsr166e note: During transition, this class |
205 |
|
* uses nested functional interfaces with different names but the |
206 |
< |
* same forms as those expected for JDK8.<em> |
206 |
> |
* same forms as those expected for JDK8.</em> |
207 |
|
* |
208 |
|
* <p>This class is a member of the |
209 |
|
* <a href="{@docRoot}/../technotes/guides/collections/index.html"> |
225 |
|
* portion of the elements, and so may be amenable to parallel |
226 |
|
* execution. |
227 |
|
* |
228 |
< |
* <p> This interface exports a subset of expected JDK8 |
228 |
> |
* <p>This interface exports a subset of expected JDK8 |
229 |
|
* functionality. |
230 |
|
* |
231 |
|
* <p>Sample usage: Here is one (of the several) ways to compute |
2713 |
|
* Maps the specified key to the specified value in this table. |
2714 |
|
* Neither the key nor the value can be null. |
2715 |
|
* |
2716 |
< |
* <p> The value can be retrieved by calling the {@code get} method |
2716 |
> |
* <p>The value can be retrieved by calling the {@code get} method |
2717 |
|
* with a key that is equal to the original key. |
2718 |
|
* |
2719 |
|
* @param key key with which the specified value is to be associated |
3010 |
|
/** |
3011 |
|
* Returns a {@link Collection} view of the values contained in this map. |
3012 |
|
* The collection is backed by the map, so changes to the map are |
3013 |
< |
* reflected in the collection, and vice-versa. |
3013 |
> |
* reflected in the collection, and vice-versa. |
3014 |
|
*/ |
3015 |
|
public ValuesView<K,V> values() { |
3016 |
|
ValuesView<K,V> vs = values; |
4247 |
|
return ForkJoinTasks.reduceKeysToLong |
4248 |
|
(map, transformer, basis, reducer).invoke(); |
4249 |
|
} |
4250 |
< |
|
4250 |
> |
|
4251 |
|
/** |
4252 |
|
* Returns the result of accumulating the given transformation |
4253 |
|
* of all keys using the given reducer to combine values, and |
4266 |
|
return ForkJoinTasks.reduceKeysToInt |
4267 |
|
(map, transformer, basis, reducer).invoke(); |
4268 |
|
} |
4269 |
< |
|
4269 |
> |
|
4270 |
|
} |
4271 |
|
|
4272 |
|
/** |
4388 |
|
return ForkJoinTasks.reduceValues |
4389 |
|
(map, transformer, reducer).invoke(); |
4390 |
|
} |
4391 |
< |
|
4391 |
> |
|
4392 |
|
/** |
4393 |
|
* Returns the result of accumulating the given transformation |
4394 |
|
* of all values using the given reducer to combine values, |