changeset 8268:191bba4888f4

Decouple Collectors from main stream implementation
author briangoetz
date Sat, 20 Apr 2013 12:20:23 -0400
parents b7cd01c971d2
children 62ee7f5ff8d1
files src/share/classes/java/util/stream/Collectors.java src/share/classes/java/util/stream/Nodes.java
diffstat 2 files changed, 5 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/java/util/stream/Collectors.java	Sat Apr 20 12:19:30 2013 -0400
+++ b/src/share/classes/java/util/stream/Collectors.java	Sat Apr 20 12:20:23 2013 -0400
@@ -273,6 +273,9 @@
      * new {@code Set}. There are no guarantees on the type, mutability,
      * serializability, or thread-safety of the {@code Set} returned.
      *
+     * <p>This is an {@link Collector.Characteristics#UNORDERED unordered}
+     * Collector.
+     *
      * @param <T> The type of the input elements
      * @return A {@code Collector} which collects all the input elements into a
      * {@code Set}
--- a/src/share/classes/java/util/stream/Nodes.java	Sat Apr 20 12:19:30 2013 -0400
+++ b/src/share/classes/java/util/stream/Nodes.java	Sat Apr 20 12:20:23 2013 -0400
@@ -39,8 +39,6 @@
 import java.util.function.IntFunction;
 import java.util.function.LongConsumer;
 
-import static java.util.stream.Collectors.toStringJoiner;
-
 /**
  * Factory methods for constructing implementations of {@link Node} and
  * {@link Node.Builder} and their primitive specializations.  Fork/Join tasks
@@ -889,11 +887,7 @@
         @Override
         public String toString() {
             if (count() < 32) {
-                return String.format("ConcNode[%s]",
-                                     Arrays.asList(left, right).stream()
-                                           .map(Object::toString)
-                                           .collect(toStringJoiner(","))
-                                           .toString());
+                return String.format("ConcNode[%s.%s]", left, right);
             } else {
                 return String.format("ConcNode[size=%d]", count());
             }
@@ -1362,11 +1356,7 @@
         @Override
         public String toString() {
             if (count() < 32)
-                return String.format("%s[%s]", this.getClass().getName(),
-                                     Arrays.asList(left, right).stream()
-                                           .map(Object::toString)
-                                           .collect(toStringJoiner(","))
-                                           .toString());
+                return String.format("%s[%s.%s]", this.getClass().getName(), left, right);
             else
                 return String.format("%s[size=%d]", this.getClass().getName(), count());
         }