提交 ceeda996 编写于 作者: C chegar

8015963: Add at since tags to new ConcurrentHashMap methods

Reviewed-by: shade, martin
上级 4b9cd322
...@@ -2610,6 +2610,7 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V> ...@@ -2610,6 +2610,7 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
* from the given type to {@code Boolean.TRUE}. * from the given type to {@code Boolean.TRUE}.
* *
* @return the new set * @return the new set
* @since 1.8
*/ */
public static <K> KeySetView<K,Boolean> newKeySet() { public static <K> KeySetView<K,Boolean> newKeySet() {
return new KeySetView<K,Boolean> return new KeySetView<K,Boolean>
...@@ -2625,6 +2626,7 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V> ...@@ -2625,6 +2626,7 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
* @throws IllegalArgumentException if the initial capacity of * @throws IllegalArgumentException if the initial capacity of
* elements is negative * elements is negative
* @return the new set * @return the new set
* @since 1.8
*/ */
public static <K> KeySetView<K,Boolean> newKeySet(int initialCapacity) { public static <K> KeySetView<K,Boolean> newKeySet(int initialCapacity) {
return new KeySetView<K,Boolean> return new KeySetView<K,Boolean>
...@@ -2662,6 +2664,7 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V> ...@@ -2662,6 +2664,7 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
* there are concurrent insertions or removals. * there are concurrent insertions or removals.
* *
* @return the number of mappings * @return the number of mappings
* @since 1.8
*/ */
public long mappingCount() { public long mappingCount() {
long n = sumCount(); long n = sumCount();
...@@ -3331,6 +3334,7 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V> ...@@ -3331,6 +3334,7 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
* @param parallelismThreshold the (estimated) number of elements * @param parallelismThreshold the (estimated) number of elements
* needed for this operation to be executed in parallel * needed for this operation to be executed in parallel
* @param action the action * @param action the action
* @since 1.8
*/ */
public void forEach(long parallelismThreshold, public void forEach(long parallelismThreshold,
BiConsumer<? super K,? super V> action) { BiConsumer<? super K,? super V> action) {
...@@ -3350,6 +3354,7 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V> ...@@ -3350,6 +3354,7 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
* for an element, or null if there is no transformation (in * for an element, or null if there is no transformation (in
* which case the action is not applied) * which case the action is not applied)
* @param action the action * @param action the action
* @since 1.8
*/ */
public <U> void forEach(long parallelismThreshold, public <U> void forEach(long parallelismThreshold,
BiFunction<? super K, ? super V, ? extends U> transformer, BiFunction<? super K, ? super V, ? extends U> transformer,
...@@ -3374,6 +3379,7 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V> ...@@ -3374,6 +3379,7 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
* result on success, else null * result on success, else null
* @return a non-null result from applying the given search * @return a non-null result from applying the given search
* function on each (key, value), or null if none * function on each (key, value), or null if none
* @since 1.8
*/ */
public <U> U search(long parallelismThreshold, public <U> U search(long parallelismThreshold,
BiFunction<? super K, ? super V, ? extends U> searchFunction) { BiFunction<? super K, ? super V, ? extends U> searchFunction) {
...@@ -3396,6 +3402,7 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V> ...@@ -3396,6 +3402,7 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
* @param reducer a commutative associative combining function * @param reducer a commutative associative combining function
* @return the result of accumulating the given transformation * @return the result of accumulating the given transformation
* of all (key, value) pairs * of all (key, value) pairs
* @since 1.8
*/ */
public <U> U reduce(long parallelismThreshold, public <U> U reduce(long parallelismThreshold,
BiFunction<? super K, ? super V, ? extends U> transformer, BiFunction<? super K, ? super V, ? extends U> transformer,
...@@ -3420,6 +3427,7 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V> ...@@ -3420,6 +3427,7 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
* @param reducer a commutative associative combining function * @param reducer a commutative associative combining function
* @return the result of accumulating the given transformation * @return the result of accumulating the given transformation
* of all (key, value) pairs * of all (key, value) pairs
* @since 1.8
*/ */
public double reduceToDoubleIn(long parallelismThreshold, public double reduceToDoubleIn(long parallelismThreshold,
ToDoubleBiFunction<? super K, ? super V> transformer, ToDoubleBiFunction<? super K, ? super V> transformer,
...@@ -3445,6 +3453,7 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V> ...@@ -3445,6 +3453,7 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
* @param reducer a commutative associative combining function * @param reducer a commutative associative combining function
* @return the result of accumulating the given transformation * @return the result of accumulating the given transformation
* of all (key, value) pairs * of all (key, value) pairs
* @since 1.8
*/ */
public long reduceToLong(long parallelismThreshold, public long reduceToLong(long parallelismThreshold,
ToLongBiFunction<? super K, ? super V> transformer, ToLongBiFunction<? super K, ? super V> transformer,
...@@ -3470,6 +3479,7 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V> ...@@ -3470,6 +3479,7 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
* @param reducer a commutative associative combining function * @param reducer a commutative associative combining function
* @return the result of accumulating the given transformation * @return the result of accumulating the given transformation
* of all (key, value) pairs * of all (key, value) pairs
* @since 1.8
*/ */
public int reduceToInt(long parallelismThreshold, public int reduceToInt(long parallelismThreshold,
ToIntBiFunction<? super K, ? super V> transformer, ToIntBiFunction<? super K, ? super V> transformer,
...@@ -3488,6 +3498,7 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V> ...@@ -3488,6 +3498,7 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
* @param parallelismThreshold the (estimated) number of elements * @param parallelismThreshold the (estimated) number of elements
* needed for this operation to be executed in parallel * needed for this operation to be executed in parallel
* @param action the action * @param action the action
* @since 1.8
*/ */
public void forEachKey(long parallelismThreshold, public void forEachKey(long parallelismThreshold,
Consumer<? super K> action) { Consumer<? super K> action) {
...@@ -3507,6 +3518,7 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V> ...@@ -3507,6 +3518,7 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
* for an element, or null if there is no transformation (in * for an element, or null if there is no transformation (in
* which case the action is not applied) * which case the action is not applied)
* @param action the action * @param action the action
* @since 1.8
*/ */
public <U> void forEachKey(long parallelismThreshold, public <U> void forEachKey(long parallelismThreshold,
Function<? super K, ? extends U> transformer, Function<? super K, ? extends U> transformer,
...@@ -3531,6 +3543,7 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V> ...@@ -3531,6 +3543,7 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
* result on success, else null * result on success, else null
* @return a non-null result from applying the given search * @return a non-null result from applying the given search
* function on each key, or null if none * function on each key, or null if none
* @since 1.8
*/ */
public <U> U searchKeys(long parallelismThreshold, public <U> U searchKeys(long parallelismThreshold,
Function<? super K, ? extends U> searchFunction) { Function<? super K, ? extends U> searchFunction) {
...@@ -3549,6 +3562,7 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V> ...@@ -3549,6 +3562,7 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
* @param reducer a commutative associative combining function * @param reducer a commutative associative combining function
* @return the result of accumulating all keys using the given * @return the result of accumulating all keys using the given
* reducer to combine values, or null if none * reducer to combine values, or null if none
* @since 1.8
*/ */
public K reduceKeys(long parallelismThreshold, public K reduceKeys(long parallelismThreshold,
BiFunction<? super K, ? super K, ? extends K> reducer) { BiFunction<? super K, ? super K, ? extends K> reducer) {
...@@ -3571,6 +3585,7 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V> ...@@ -3571,6 +3585,7 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
* @param reducer a commutative associative combining function * @param reducer a commutative associative combining function
* @return the result of accumulating the given transformation * @return the result of accumulating the given transformation
* of all keys * of all keys
* @since 1.8
*/ */
public <U> U reduceKeys(long parallelismThreshold, public <U> U reduceKeys(long parallelismThreshold,
Function<? super K, ? extends U> transformer, Function<? super K, ? extends U> transformer,
...@@ -3595,6 +3610,7 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V> ...@@ -3595,6 +3610,7 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
* @param reducer a commutative associative combining function * @param reducer a commutative associative combining function
* @return the result of accumulating the given transformation * @return the result of accumulating the given transformation
* of all keys * of all keys
* @since 1.8
*/ */
public double reduceKeysToDouble(long parallelismThreshold, public double reduceKeysToDouble(long parallelismThreshold,
ToDoubleFunction<? super K> transformer, ToDoubleFunction<? super K> transformer,
...@@ -3620,6 +3636,7 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V> ...@@ -3620,6 +3636,7 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
* @param reducer a commutative associative combining function * @param reducer a commutative associative combining function
* @return the result of accumulating the given transformation * @return the result of accumulating the given transformation
* of all keys * of all keys
* @since 1.8
*/ */
public long reduceKeysToLong(long parallelismThreshold, public long reduceKeysToLong(long parallelismThreshold,
ToLongFunction<? super K> transformer, ToLongFunction<? super K> transformer,
...@@ -3645,6 +3662,7 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V> ...@@ -3645,6 +3662,7 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
* @param reducer a commutative associative combining function * @param reducer a commutative associative combining function
* @return the result of accumulating the given transformation * @return the result of accumulating the given transformation
* of all keys * of all keys
* @since 1.8
*/ */
public int reduceKeysToInt(long parallelismThreshold, public int reduceKeysToInt(long parallelismThreshold,
ToIntFunction<? super K> transformer, ToIntFunction<? super K> transformer,
...@@ -3663,6 +3681,7 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V> ...@@ -3663,6 +3681,7 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
* @param parallelismThreshold the (estimated) number of elements * @param parallelismThreshold the (estimated) number of elements
* needed for this operation to be executed in parallel * needed for this operation to be executed in parallel
* @param action the action * @param action the action
* @since 1.8
*/ */
public void forEachValue(long parallelismThreshold, public void forEachValue(long parallelismThreshold,
Consumer<? super V> action) { Consumer<? super V> action) {
...@@ -3683,6 +3702,7 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V> ...@@ -3683,6 +3702,7 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
* for an element, or null if there is no transformation (in * for an element, or null if there is no transformation (in
* which case the action is not applied) * which case the action is not applied)
* @param action the action * @param action the action
* @since 1.8
*/ */
public <U> void forEachValue(long parallelismThreshold, public <U> void forEachValue(long parallelismThreshold,
Function<? super V, ? extends U> transformer, Function<? super V, ? extends U> transformer,
...@@ -3707,6 +3727,7 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V> ...@@ -3707,6 +3727,7 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
* result on success, else null * result on success, else null
* @return a non-null result from applying the given search * @return a non-null result from applying the given search
* function on each value, or null if none * function on each value, or null if none
* @since 1.8
*/ */
public <U> U searchValues(long parallelismThreshold, public <U> U searchValues(long parallelismThreshold,
Function<? super V, ? extends U> searchFunction) { Function<? super V, ? extends U> searchFunction) {
...@@ -3724,6 +3745,7 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V> ...@@ -3724,6 +3745,7 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
* needed for this operation to be executed in parallel * needed for this operation to be executed in parallel
* @param reducer a commutative associative combining function * @param reducer a commutative associative combining function
* @return the result of accumulating all values * @return the result of accumulating all values
* @since 1.8
*/ */
public V reduceValues(long parallelismThreshold, public V reduceValues(long parallelismThreshold,
BiFunction<? super V, ? super V, ? extends V> reducer) { BiFunction<? super V, ? super V, ? extends V> reducer) {
...@@ -3746,6 +3768,7 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V> ...@@ -3746,6 +3768,7 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
* @param reducer a commutative associative combining function * @param reducer a commutative associative combining function
* @return the result of accumulating the given transformation * @return the result of accumulating the given transformation
* of all values * of all values
* @since 1.8
*/ */
public <U> U reduceValues(long parallelismThreshold, public <U> U reduceValues(long parallelismThreshold,
Function<? super V, ? extends U> transformer, Function<? super V, ? extends U> transformer,
...@@ -3770,6 +3793,7 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V> ...@@ -3770,6 +3793,7 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
* @param reducer a commutative associative combining function * @param reducer a commutative associative combining function
* @return the result of accumulating the given transformation * @return the result of accumulating the given transformation
* of all values * of all values
* @since 1.8
*/ */
public double reduceValuesToDouble(long parallelismThreshold, public double reduceValuesToDouble(long parallelismThreshold,
ToDoubleFunction<? super V> transformer, ToDoubleFunction<? super V> transformer,
...@@ -3795,6 +3819,7 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V> ...@@ -3795,6 +3819,7 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
* @param reducer a commutative associative combining function * @param reducer a commutative associative combining function
* @return the result of accumulating the given transformation * @return the result of accumulating the given transformation
* of all values * of all values
* @since 1.8
*/ */
public long reduceValuesToLong(long parallelismThreshold, public long reduceValuesToLong(long parallelismThreshold,
ToLongFunction<? super V> transformer, ToLongFunction<? super V> transformer,
...@@ -3820,6 +3845,7 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V> ...@@ -3820,6 +3845,7 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
* @param reducer a commutative associative combining function * @param reducer a commutative associative combining function
* @return the result of accumulating the given transformation * @return the result of accumulating the given transformation
* of all values * of all values
* @since 1.8
*/ */
public int reduceValuesToInt(long parallelismThreshold, public int reduceValuesToInt(long parallelismThreshold,
ToIntFunction<? super V> transformer, ToIntFunction<? super V> transformer,
...@@ -3838,6 +3864,7 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V> ...@@ -3838,6 +3864,7 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
* @param parallelismThreshold the (estimated) number of elements * @param parallelismThreshold the (estimated) number of elements
* needed for this operation to be executed in parallel * needed for this operation to be executed in parallel
* @param action the action * @param action the action
* @since 1.8
*/ */
public void forEachEntry(long parallelismThreshold, public void forEachEntry(long parallelismThreshold,
Consumer<? super Map.Entry<K,V>> action) { Consumer<? super Map.Entry<K,V>> action) {
...@@ -3856,6 +3883,7 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V> ...@@ -3856,6 +3883,7 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
* for an element, or null if there is no transformation (in * for an element, or null if there is no transformation (in
* which case the action is not applied) * which case the action is not applied)
* @param action the action * @param action the action
* @since 1.8
*/ */
public <U> void forEachEntry(long parallelismThreshold, public <U> void forEachEntry(long parallelismThreshold,
Function<Map.Entry<K,V>, ? extends U> transformer, Function<Map.Entry<K,V>, ? extends U> transformer,
...@@ -3880,6 +3908,7 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V> ...@@ -3880,6 +3908,7 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
* result on success, else null * result on success, else null
* @return a non-null result from applying the given search * @return a non-null result from applying the given search
* function on each entry, or null if none * function on each entry, or null if none
* @since 1.8
*/ */
public <U> U searchEntries(long parallelismThreshold, public <U> U searchEntries(long parallelismThreshold,
Function<Map.Entry<K,V>, ? extends U> searchFunction) { Function<Map.Entry<K,V>, ? extends U> searchFunction) {
...@@ -3897,6 +3926,7 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V> ...@@ -3897,6 +3926,7 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
* needed for this operation to be executed in parallel * needed for this operation to be executed in parallel
* @param reducer a commutative associative combining function * @param reducer a commutative associative combining function
* @return the result of accumulating all entries * @return the result of accumulating all entries
* @since 1.8
*/ */
public Map.Entry<K,V> reduceEntries(long parallelismThreshold, public Map.Entry<K,V> reduceEntries(long parallelismThreshold,
BiFunction<Map.Entry<K,V>, Map.Entry<K,V>, ? extends Map.Entry<K,V>> reducer) { BiFunction<Map.Entry<K,V>, Map.Entry<K,V>, ? extends Map.Entry<K,V>> reducer) {
...@@ -3919,6 +3949,7 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V> ...@@ -3919,6 +3949,7 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
* @param reducer a commutative associative combining function * @param reducer a commutative associative combining function
* @return the result of accumulating the given transformation * @return the result of accumulating the given transformation
* of all entries * of all entries
* @since 1.8
*/ */
public <U> U reduceEntries(long parallelismThreshold, public <U> U reduceEntries(long parallelismThreshold,
Function<Map.Entry<K,V>, ? extends U> transformer, Function<Map.Entry<K,V>, ? extends U> transformer,
...@@ -3943,6 +3974,7 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V> ...@@ -3943,6 +3974,7 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
* @param reducer a commutative associative combining function * @param reducer a commutative associative combining function
* @return the result of accumulating the given transformation * @return the result of accumulating the given transformation
* of all entries * of all entries
* @since 1.8
*/ */
public double reduceEntriesToDouble(long parallelismThreshold, public double reduceEntriesToDouble(long parallelismThreshold,
ToDoubleFunction<Map.Entry<K,V>> transformer, ToDoubleFunction<Map.Entry<K,V>> transformer,
...@@ -3968,6 +4000,7 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V> ...@@ -3968,6 +4000,7 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
* @param reducer a commutative associative combining function * @param reducer a commutative associative combining function
* @return the result of accumulating the given transformation * @return the result of accumulating the given transformation
* of all entries * of all entries
* @since 1.8
*/ */
public long reduceEntriesToLong(long parallelismThreshold, public long reduceEntriesToLong(long parallelismThreshold,
ToLongFunction<Map.Entry<K,V>> transformer, ToLongFunction<Map.Entry<K,V>> transformer,
...@@ -3993,6 +4026,7 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V> ...@@ -3993,6 +4026,7 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
* @param reducer a commutative associative combining function * @param reducer a commutative associative combining function
* @return the result of accumulating the given transformation * @return the result of accumulating the given transformation
* of all entries * of all entries
* @since 1.8
*/ */
public int reduceEntriesToInt(long parallelismThreshold, public int reduceEntriesToInt(long parallelismThreshold,
ToIntFunction<Map.Entry<K,V>> transformer, ToIntFunction<Map.Entry<K,V>> transformer,
...@@ -4168,6 +4202,7 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V> ...@@ -4168,6 +4202,7 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
* {@link #keySet(Object) keySet(V)}, * {@link #keySet(Object) keySet(V)},
* {@link #newKeySet() newKeySet()}, * {@link #newKeySet() newKeySet()},
* {@link #newKeySet(int) newKeySet(int)}. * {@link #newKeySet(int) newKeySet(int)}.
* @since 1.8
*/ */
public static class KeySetView<K,V> extends CollectionView<K,V,K> public static class KeySetView<K,V> extends CollectionView<K,V,K>
implements Set<K>, java.io.Serializable { implements Set<K>, java.io.Serializable {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册