-
Bug
-
Resolution: Fixed
-
P4
-
None
-
b20
-
Verified
The class doc for j.u.c.atomic.LongAdder has an incorrect example. The call to computeIfAbsent has the wrong number of arguments.
Suggested patch:
diff -r 79a6703ab839 src/share/classes/java/util/concurrent/atomic/LongAdder.java
--- a/src/share/classes/java/util/concurrent/atomic/LongAdder.java Thu May 29 15:50:36 2014 +0100
+++ b/src/share/classes/java/util/concurrent/atomic/LongAdder.java Fri May 30 16:11:03 2014 -0700
@@ -57,7 +57,7 @@
* 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
Suggested patch:
diff -r 79a6703ab839 src/share/classes/java/util/concurrent/atomic/LongAdder.java
--- a/src/share/classes/java/util/concurrent/atomic/LongAdder.java Thu May 29 15:50:36 2014 +0100
+++ b/src/share/classes/java/util/concurrent/atomic/LongAdder.java Fri May 30 16:11:03 2014 -0700
@@ -57,7 +57,7 @@
* 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
- duplicates
-
JDK-8145745 Wrong exmple in document
-
- Closed
-
-
JDK-8177868 Typo in LongAdder documentation
-
- Closed
-