# HG changeset patch # User chegar # Date 1421169291 0 # Node ID 361e3aa27cb5c41724e4ab4867674f033259fcbf # Parent 7593914c0304f4547e76f3b8decf62d342300b9f 8068599: Add mutability, serializability, and thread-safety, caveat to all Collectors that do not accept a Collection supplier Reviewed-by: psandoz diff -r 7593914c0304 -r 361e3aa27cb5 jdk/src/java.base/share/classes/java/util/stream/Collectors.java --- a/jdk/src/java.base/share/classes/java/util/stream/Collectors.java Tue Jan 13 08:58:07 2015 -0800 +++ b/jdk/src/java.base/share/classes/java/util/stream/Collectors.java Tue Jan 13 17:14:51 2015 +0000 @@ -990,7 +990,7 @@ * function. * *
There are no guarantees on the type, mutability, or serializability
- * of the {@code Map} or {@code List} objects returned, or of the
+ * of the {@code ConcurrentMap} or {@code List} objects returned, or of the
* thread-safety of the {@code List} objects returned.
* @implSpec
* This produces a result similar to:
@@ -1028,6 +1028,9 @@
* produces a result of type {@code D}. The resulting collector produces a
* {@code Map There are no guarantees on the type, mutability, or serializability
+ * of the {@code ConcurrentMap} returned.
+ *
* For example, to compute the set of last names of people in each city,
* where the city names are sorted:
* There are no guarantees on the type, mutability, serializability,
+ * or thread-safety of the {@code Map} returned.
+ *
* @apiNote
* It is common for either the key or the value to be the input elements.
* In this case, the utility method
@@ -1271,6 +1278,9 @@
* the value mapping function is applied to each equal element, and the
* results are merged using the provided merging function.
*
+ * There are no guarantees on the type, mutability, serializability,
+ * or thread-safety of the {@code Map} returned.
+ *
* @apiNote
* There are multiple ways to deal with collisions between multiple elements
* mapping to the same key. The other forms of {@code toMap} simply use
@@ -1382,6 +1392,9 @@
* may have duplicates, use
* {@link #toConcurrentMap(Function, Function, BinaryOperator)} instead.
*
+ * There are no guarantees on the type, mutability, or serializability
+ * of the {@code ConcurrentMap} returned.
+ *
* @apiNote
* It is common for either the key or the value to be the input elements.
* In this case, the utility method
@@ -1436,6 +1449,9 @@
* the value mapping function is applied to each equal element, and the
* results are merged using the provided merging function.
*
+ * There are no guarantees on the type, mutability, or serializability
+ * of the {@code ConcurrentMap} returned.
+ *
* @apiNote
* There are multiple ways to deal with collisions between multiple elements
* mapping to the same key. The other forms of {@code toConcurrentMap} simply use
{@code
@@ -1143,7 +1146,8 @@
* {@code Map