mirror of
https://github.com/openjdk/jdk.git
synced 2026-04-19 19:30:51 +00:00
8044730: small errors in ConcurrentHashMap and LongAdder docs
Reviewed-by: martin
This commit is contained in:
parent
9501b333f7
commit
7e1185e152
@ -133,12 +133,12 @@ import java.util.stream.Stream;
|
||||
* mapped values are (perhaps transiently) not used or all take the
|
||||
* same mapping value.
|
||||
*
|
||||
* <p>A ConcurrentHashMap can be used as scalable frequency map (a
|
||||
* <p>A ConcurrentHashMap can be used as a scalable frequency map (a
|
||||
* form of histogram or multiset) by using {@link
|
||||
* java.util.concurrent.atomic.LongAdder} values and initializing via
|
||||
* {@link #computeIfAbsent computeIfAbsent}. For example, to add a count
|
||||
* to a {@code ConcurrentHashMap<String,LongAdder> freqs}, you can use
|
||||
* {@code freqs.computeIfAbsent(k -> new LongAdder()).increment();}
|
||||
* {@code freqs.computeIfAbsent(key, k -> new LongAdder()).increment();}
|
||||
*
|
||||
* <p>This class and its views and iterators implement all of the
|
||||
* <em>optional</em> methods of the {@link Map} and {@link Iterator}
|
||||
|
||||
@ -57,7 +57,7 @@ import java.io.Serializable;
|
||||
* frequency map (a form of histogram or multiset). For example, to
|
||||
* add a count to a {@code ConcurrentHashMap<String,LongAdder> freqs},
|
||||
* initializing if not already present, you can use {@code
|
||||
* freqs.computeIfAbsent(k -> new LongAdder()).increment();}
|
||||
* freqs.computeIfAbsent(key, k -> new LongAdder()).increment();}
|
||||
*
|
||||
* <p>This class extends {@link Number}, but does <em>not</em> define
|
||||
* methods such as {@code equals}, {@code hashCode} and {@code
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user