# HG changeset patch # User smarks # Date 1402966341 25200 # Node ID d3304c4e66b5b015797c5568fe924ef65fad1d7e # Parent 539aecb8c7873e4deedf4eee6206aff5d812363b 8044730: small errors in ConcurrentHashMap and LongAdder docs Reviewed-by: martin diff -r 539aecb8c787 -r d3304c4e66b5 jdk/src/share/classes/java/util/concurrent/ConcurrentHashMap.java --- a/jdk/src/share/classes/java/util/concurrent/ConcurrentHashMap.java Mon Jun 16 13:48:58 2014 -0400 +++ b/jdk/src/share/classes/java/util/concurrent/ConcurrentHashMap.java Mon Jun 16 17:52:21 2014 -0700 @@ -133,12 +133,12 @@ * mapped values are (perhaps transiently) not used or all take the * same mapping value. * - *

A ConcurrentHashMap can be used as scalable frequency map (a + *

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 freqs}, you can use - * {@code freqs.computeIfAbsent(k -> new LongAdder()).increment();} + * {@code freqs.computeIfAbsent(key, k -> new LongAdder()).increment();} * *

This class and its views and iterators implement all of the * optional methods of the {@link Map} and {@link Iterator} diff -r 539aecb8c787 -r d3304c4e66b5 jdk/src/share/classes/java/util/concurrent/atomic/LongAdder.java --- a/jdk/src/share/classes/java/util/concurrent/atomic/LongAdder.java Mon Jun 16 13:48:58 2014 -0400 +++ b/jdk/src/share/classes/java/util/concurrent/atomic/LongAdder.java Mon Jun 16 17:52:21 2014 -0700 @@ -57,7 +57,7 @@ * frequency map (a form of histogram or multiset). For example, to * add a count to a {@code ConcurrentHashMap freqs}, * initializing if not already present, you can use {@code - * freqs.computeIfAbsent(k -> new LongAdder()).increment();} + * freqs.computeIfAbsent(key, k -> new LongAdder()).increment();} * *

This class extends {@link Number}, but does not define * methods such as {@code equals}, {@code hashCode} and {@code