changeset 7801:10ec7fa058dd

Rename methods in PipelineHelper to be more consistent
author briangoetz
date Tue, 02 Apr 2013 18:57:38 -0400
parents 16c0b945f076
children 3a341b419f9b
files src/share/classes/java/util/stream/AbstractPipeline.java src/share/classes/java/util/stream/DistinctOp.java src/share/classes/java/util/stream/DoublePipeline.java src/share/classes/java/util/stream/ForEachOps.java src/share/classes/java/util/stream/IntPipeline.java src/share/classes/java/util/stream/LongPipeline.java src/share/classes/java/util/stream/PipelineHelper.java src/share/classes/java/util/stream/ReferencePipeline.java src/share/classes/java/util/stream/SortedOp.java test-ng/bootlib/java/util/stream/CollectorOps.java test-ng/bootlib/java/util/stream/OpTestCase.java test-ng/tests/org/openjdk/tests/java/util/stream/SpliteratorTraversingAndSplittingTest.java
diffstat 12 files changed, 118 insertions(+), 142 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/java/util/stream/AbstractPipeline.java	Sun Mar 03 20:52:04 2013 -0800
+++ b/src/share/classes/java/util/stream/AbstractPipeline.java	Tue Apr 02 18:57:38 2013 -0400
@@ -172,10 +172,6 @@
         this.depth = previousStage.depth + 1;
     }
 
-    static <T> IntFunction<T[]> objectArrayGenerator() {
-        return size -> (T[]) new Object[size];
-    }
-
     // Chaining and result methods
 
     /**
@@ -225,26 +221,6 @@
     }
 
     /**
-     * Evaluate the pipeline with a terminal operation to produce a result.
-     *
-     * @param terminalOp the terminal operation to be applied to the pipeline.
-     * @param <R> the type of result.
-     * @return the result.
-     */
-    public <R> R pipeline(TerminalOp<E_OUT, R> terminalOp) {
-        assert getOutputShape() == terminalOp.inputShape();
-        if (linkedOrConsumed)
-            throw new IllegalStateException("stream has already been operated upon");
-        linkedOrConsumed = true;
-
-        prepare(terminalOp.getOpFlags());
-        PipelineHelperImpl helper = new PipelineHelperImpl();
-        return isParallel()
-               ? (R) terminalOp.evaluateParallel(helper, sourceSpliterator())
-               : (R) terminalOp.evaluateSequential(helper, sourceSpliterator());
-    }
-
-    /**
      * Prepare the pipeline for evaluation.
      * @param terminalFlags
      */
@@ -298,48 +274,48 @@
     }
 
     /**
-     * Collect the elements output from the pipeline.
+     * Evaluate the pipeline with a terminal operation to produce a result.
      *
-     * @param flatten if true the Node returned will contain no children,
-     *                otherwise the Node represents the root in a tree that
-     *                reflects the computation tree.
-     * @return a node that holds the collected output elements.
+     * @param terminalOp the terminal operation to be applied to the pipeline.
+     * @param <R> the type of result.
+     * @return the result.
      */
-    @SuppressWarnings("unchecked")
-    public Node<E_OUT> collectOutput(boolean flatten) {
-        return collectOutput(flatten, AbstractPipeline.objectArrayGenerator());
+    public <R> R evaluate(TerminalOp<E_OUT, R> terminalOp) {
+        assert getOutputShape() == terminalOp.inputShape();
+        if (linkedOrConsumed)
+            throw new IllegalStateException("stream has already been operated upon");
+        linkedOrConsumed = true;
+
+        prepare(terminalOp.getOpFlags());
+        PipelineHelperImpl helper = new PipelineHelperImpl();
+        return isParallel()
+               ? (R) terminalOp.evaluateParallel(helper, sourceSpliterator())
+               : (R) terminalOp.evaluateSequential(helper, sourceSpliterator());
     }
 
     /**
      * Collect the elements output from the pipeline.
      *
-     * @param flatten if true the Node returned will contain no children,
-     *                otherwise the Node represents the root in a tree that
-     *                reflects the computation tree.
      * @param generator the array generator to be used to create array instances.
      * @return a node that holds the collected output elements.
      */
-    public Node<E_OUT> collectOutput(boolean flatten, IntFunction<E_OUT[]> generator) {
+    public Node<E_OUT> evaluateToArrayNode(IntFunction<E_OUT[]> generator) {
         if (linkedOrConsumed)
             throw new IllegalStateException("stream has already been operated upon");
         linkedOrConsumed = true;
 
         prepare(0);
-        if (isParallel()) {
-            // If the last intermediate operation is stateful then
-            // evaluate directly to avoid an extra collection step
-            if (op != null && op.isStateful()) {
-                PipelineHelperImpl helper = previousStage.new PipelineHelperImpl();
-                Node<E_OUT> node = op.evaluateParallel(helper, previousStage.sourceSpliterator(), generator);
-                if (flatten) {
-                    node = node.flatten(generator);
-                }
-                return node;
-            }
+        // If the last intermediate operation is stateful then
+        // evaluate directly to avoid an extra collection step
+        if (isParallel() && op != null && op.isStateful()) {
+            PipelineHelperImpl helper = previousStage.new PipelineHelperImpl();
+            return op.evaluateParallel(helper, previousStage.sourceSpliterator(), generator)
+                     .flatten(generator);
         }
-
-        PipelineHelperImpl helper = new PipelineHelperImpl();
-        return helper.collectOutput(sourceSpliterator(), flatten, generator);
+        else {
+            PipelineHelperImpl helper = new PipelineHelperImpl();
+            return helper.evaluate(sourceSpliterator(), true, generator);
+        }
     }
 
     /** Common implementation of {@code limit()} / {@code substream} for all shapes */
@@ -386,10 +362,10 @@
      * @param generator the array generator
      * @return the node holding elements output from the pipeline.
      */
-    protected abstract<P_IN> Node<E_OUT> collect(PipelineHelper<P_IN, E_OUT> helper,
-                                                 Spliterator<P_IN> spliterator,
-                                                 boolean flattenTree,
-                                                 IntFunction<E_OUT[]> generator);
+    protected abstract<P_IN> Node<E_OUT> evaluateToNode(PipelineHelper<P_IN, E_OUT> helper,
+                                                        Spliterator<P_IN> spliterator,
+                                                        boolean flattenTree,
+                                                        IntFunction<E_OUT[]> generator);
 
     /**
      * Create a spliterator that wraps a source spliterator, compatible with this stream shape,
@@ -651,12 +627,12 @@
 
         @Override
         @SuppressWarnings("unchecked")
-        public Node<E_OUT> collectOutput(Spliterator<P_IN> spliterator,
-                                         boolean flatten,
-                                         IntFunction<E_OUT[]> generator) {
+        public Node<E_OUT> evaluate(Spliterator<P_IN> spliterator,
+                                    boolean flatten,
+                                    IntFunction<E_OUT[]> generator) {
             if (isParallel()) {
                 // @@@ Optimize if op of this pipeline stage is a stateful op
-                return collect(this, spliterator, flatten, generator);
+                return evaluateToNode(this, spliterator, flatten, generator);
             }
             else {
                 Node.Builder<E_OUT> nb = makeNodeBuilder(
--- a/src/share/classes/java/util/stream/DistinctOp.java	Sun Mar 03 20:52:04 2013 -0800
+++ b/src/share/classes/java/util/stream/DistinctOp.java	Tue Apr 02 18:57:38 2013 -0400
@@ -116,7 +116,7 @@
                                         IntFunction<T[]> generator) {
         if (StreamOpFlag.DISTINCT.isKnown(helper.getStreamAndOpFlags())) {
             // No-op
-            return helper.collectOutput(spliterator, false, generator);
+            return helper.evaluate(spliterator, false, generator);
         }
         else if (StreamOpFlag.ORDERED.isKnown(helper.getStreamAndOpFlags())) {
             // If the stream is SORTED then it should also be ORDERED so the following will also
--- a/src/share/classes/java/util/stream/DoublePipeline.java	Sun Mar 03 20:52:04 2013 -0800
+++ b/src/share/classes/java/util/stream/DoublePipeline.java	Tue Apr 02 18:57:38 2013 -0400
@@ -88,10 +88,10 @@
     }
 
     @Override
-    protected <P_IN> Node<Double> collect(PipelineHelper<P_IN, Double> helper,
-                                          Spliterator<P_IN> spliterator,
-                                          boolean flattenTree,
-                                          IntFunction<Double[]> generator) {
+    protected <P_IN> Node<Double> evaluateToNode(PipelineHelper<P_IN, Double> helper,
+                                                 Spliterator<P_IN> spliterator,
+                                                 boolean flattenTree,
+                                                 IntFunction<Double[]> generator) {
         return NodeUtils.doubleCollect(helper, spliterator, flattenTree);
     }
 
@@ -291,12 +291,12 @@
 
     @Override
     public void forEach(DoubleConsumer consumer) {
-        pipeline(ForEachOps.makeDouble(consumer, false));
+        evaluate(ForEachOps.makeDouble(consumer, false));
     }
 
     @Override
     public void forEachOrdered(DoubleConsumer consumer) {
-        pipeline(ForEachOps.makeDouble(consumer, true));
+        evaluate(ForEachOps.makeDouble(consumer, true));
     }
 
     @Override
@@ -341,12 +341,12 @@
 
     @Override
     public double reduce(double identity, DoubleBinaryOperator op) {
-        return pipeline(ReduceOps.makeDouble(identity, op));
+        return evaluate(ReduceOps.makeDouble(identity, op));
     }
 
     @Override
     public OptionalDouble reduce(DoubleBinaryOperator op) {
-        return pipeline(ReduceOps.makeDouble(op));
+        return evaluate(ReduceOps.makeDouble(op));
     }
 
     @Override
@@ -355,36 +355,36 @@
             combiner.accept(left, right);
             return left;
         };
-        return pipeline(ReduceOps.makeDouble(resultFactory, accumulator, operator));
+        return evaluate(ReduceOps.makeDouble(resultFactory, accumulator, operator));
     }
 
     @Override
     public boolean anyMatch(DoublePredicate predicate) {
-        return pipeline(MatchOps.makeDouble(predicate, MatchOps.MatchKind.ANY));
+        return evaluate(MatchOps.makeDouble(predicate, MatchOps.MatchKind.ANY));
     }
 
     @Override
     public boolean allMatch(DoublePredicate predicate) {
-        return pipeline(MatchOps.makeDouble(predicate, MatchOps.MatchKind.ALL));
+        return evaluate(MatchOps.makeDouble(predicate, MatchOps.MatchKind.ALL));
     }
 
     @Override
     public boolean noneMatch(DoublePredicate predicate) {
-        return pipeline(MatchOps.makeDouble(predicate, MatchOps.MatchKind.NONE));
+        return evaluate(MatchOps.makeDouble(predicate, MatchOps.MatchKind.NONE));
     }
 
     @Override
     public OptionalDouble findFirst() {
-        return pipeline(FindOps.makeDouble(true));
+        return evaluate(FindOps.makeDouble(true));
     }
 
     @Override
     public OptionalDouble findAny() {
-        return pipeline(FindOps.makeDouble(false));
+        return evaluate(FindOps.makeDouble(false));
     }
 
     @Override
     public double[] toArray() {
-        return ((Node.OfDouble) collectOutput(true)).asDoubleArray();
+        return ((Node.OfDouble) evaluateToArrayNode(Double[]::new)).asDoubleArray();
     }
 }
--- a/src/share/classes/java/util/stream/ForEachOps.java	Sun Mar 03 20:52:04 2013 -0800
+++ b/src/share/classes/java/util/stream/ForEachOps.java	Tue Apr 02 18:57:38 2013 -0400
@@ -340,7 +340,7 @@
                     else {
                         Node.Builder<T> nb = task.helper.makeNodeBuilder(
                                 task.helper.exactOutputSizeIfKnown(task.spliterator),
-                                AbstractPipeline.objectArrayGenerator());
+                                size -> (T[]) new Object[size]);
                         task.node = task.helper.wrapAndCopyInto(nb, task.spliterator).build();
                     }
                     task.tryComplete();
--- a/src/share/classes/java/util/stream/IntPipeline.java	Sun Mar 03 20:52:04 2013 -0800
+++ b/src/share/classes/java/util/stream/IntPipeline.java	Tue Apr 02 18:57:38 2013 -0400
@@ -88,10 +88,10 @@
     }
 
     @Override
-    protected <P_IN> Node<Integer> collect(PipelineHelper<P_IN, Integer> helper,
-                                           Spliterator<P_IN> spliterator,
-                                           boolean flattenTree,
-                                           IntFunction<Integer[]> generator) {
+    protected <P_IN> Node<Integer> evaluateToNode(PipelineHelper<P_IN, Integer> helper,
+                                                  Spliterator<P_IN> spliterator,
+                                                  boolean flattenTree,
+                                                  IntFunction<Integer[]> generator) {
         return NodeUtils.intCollect(helper, spliterator, flattenTree);
     }
 
@@ -313,12 +313,12 @@
 
     @Override
     public void forEach(IntConsumer consumer) {
-        pipeline(ForEachOps.makeInt(consumer, false));
+        evaluate(ForEachOps.makeInt(consumer, false));
     }
 
     @Override
     public void forEachOrdered(IntConsumer consumer) {
-        pipeline(ForEachOps.makeInt(consumer, true));
+        evaluate(ForEachOps.makeInt(consumer, true));
     }
 
     @Override
@@ -362,12 +362,12 @@
 
     @Override
     public int reduce(int identity, IntBinaryOperator op) {
-        return pipeline(ReduceOps.makeInt(identity, op));
+        return evaluate(ReduceOps.makeInt(identity, op));
     }
 
     @Override
     public OptionalInt reduce(IntBinaryOperator op) {
-        return pipeline(ReduceOps.makeInt(op));
+        return evaluate(ReduceOps.makeInt(op));
     }
 
     @Override
@@ -376,36 +376,36 @@
             combiner.accept(left, right);
             return left;
         };
-        return pipeline(ReduceOps.makeInt(resultFactory, accumulator, operator));
+        return evaluate(ReduceOps.makeInt(resultFactory, accumulator, operator));
     }
 
     @Override
     public boolean anyMatch(IntPredicate predicate) {
-        return pipeline(MatchOps.makeInt(predicate, MatchOps.MatchKind.ANY));
+        return evaluate(MatchOps.makeInt(predicate, MatchOps.MatchKind.ANY));
     }
 
     @Override
     public boolean allMatch(IntPredicate predicate) {
-        return pipeline(MatchOps.makeInt(predicate, MatchOps.MatchKind.ALL));
+        return evaluate(MatchOps.makeInt(predicate, MatchOps.MatchKind.ALL));
     }
 
     @Override
     public boolean noneMatch(IntPredicate predicate) {
-        return pipeline(MatchOps.makeInt(predicate, MatchOps.MatchKind.NONE));
+        return evaluate(MatchOps.makeInt(predicate, MatchOps.MatchKind.NONE));
     }
 
     @Override
     public OptionalInt findFirst() {
-        return pipeline(FindOps.makeInt(true));
+        return evaluate(FindOps.makeInt(true));
     }
 
     @Override
     public OptionalInt findAny() {
-        return pipeline(FindOps.makeInt(false));
+        return evaluate(FindOps.makeInt(false));
     }
 
     @Override
     public int[] toArray() {
-        return ((Node.OfInt) collectOutput(true)).asIntArray();
+        return ((Node.OfInt) evaluateToArrayNode(Integer[]::new)).asIntArray();
     }
 }
--- a/src/share/classes/java/util/stream/LongPipeline.java	Sun Mar 03 20:52:04 2013 -0800
+++ b/src/share/classes/java/util/stream/LongPipeline.java	Tue Apr 02 18:57:38 2013 -0400
@@ -89,10 +89,10 @@
     }
 
     @Override
-    protected <P_IN> Node<Long> collect(PipelineHelper<P_IN, Long> helper,
-                                        Spliterator<P_IN> spliterator,
-                                        boolean flattenTree,
-                                        IntFunction<Long[]> generator) {
+    protected <P_IN> Node<Long> evaluateToNode(PipelineHelper<P_IN, Long> helper,
+                                               Spliterator<P_IN> spliterator,
+                                               boolean flattenTree,
+                                               IntFunction<Long[]> generator) {
         return NodeUtils.longCollect(helper, spliterator, flattenTree);
     }
 
@@ -303,12 +303,12 @@
 
     @Override
     public void forEach(LongConsumer consumer) {
-        pipeline(ForEachOps.makeLong(consumer, false));
+        evaluate(ForEachOps.makeLong(consumer, false));
     }
 
     @Override
     public void forEachOrdered(LongConsumer consumer) {
-        pipeline(ForEachOps.makeLong(consumer, true));
+        evaluate(ForEachOps.makeLong(consumer, true));
     }
 
     @Override
@@ -353,12 +353,12 @@
 
     @Override
     public long reduce(long identity, LongBinaryOperator op) {
-        return pipeline(ReduceOps.makeLong(identity, op));
+        return evaluate(ReduceOps.makeLong(identity, op));
     }
 
     @Override
     public OptionalLong reduce(LongBinaryOperator op) {
-        return pipeline(ReduceOps.makeLong(op));
+        return evaluate(ReduceOps.makeLong(op));
     }
 
     @Override
@@ -367,36 +367,36 @@
             combiner.accept(left, right);
             return left;
         };
-        return pipeline(ReduceOps.makeLong(resultFactory, accumulator, operator));
+        return evaluate(ReduceOps.makeLong(resultFactory, accumulator, operator));
     }
 
     @Override
     public boolean anyMatch(LongPredicate predicate) {
-        return pipeline(MatchOps.makeLong(predicate, MatchOps.MatchKind.ANY));
+        return evaluate(MatchOps.makeLong(predicate, MatchOps.MatchKind.ANY));
     }
 
     @Override
     public boolean allMatch(LongPredicate predicate) {
-        return pipeline(MatchOps.makeLong(predicate, MatchOps.MatchKind.ALL));
+        return evaluate(MatchOps.makeLong(predicate, MatchOps.MatchKind.ALL));
     }
 
     @Override
     public boolean noneMatch(LongPredicate predicate) {
-        return pipeline(MatchOps.makeLong(predicate, MatchOps.MatchKind.NONE));
+        return evaluate(MatchOps.makeLong(predicate, MatchOps.MatchKind.NONE));
     }
 
     @Override
     public OptionalLong findFirst() {
-        return pipeline(FindOps.makeLong(true));
+        return evaluate(FindOps.makeLong(true));
     }
 
     @Override
     public OptionalLong findAny() {
-        return pipeline(FindOps.makeLong(false));
+        return evaluate(FindOps.makeLong(false));
     }
 
     @Override
     public long[] toArray() {
-        return ((Node.OfLong) collectOutput(true)).asLongArray();
+        return ((Node.OfLong) evaluateToArrayNode(Long[]::new)).asLongArray();
     }
 }
--- a/src/share/classes/java/util/stream/PipelineHelper.java	Sun Mar 03 20:52:04 2013 -0800
+++ b/src/share/classes/java/util/stream/PipelineHelper.java	Tue Apr 02 18:57:38 2013 -0400
@@ -170,9 +170,9 @@
      * @param generator the array generator
      * @return the {@code Node} containing all output elements
      */
-    Node<P_OUT> collectOutput(Spliterator<P_IN> spliterator,
-                              boolean flatten,
-                              IntFunction<P_OUT[]> generator);
+    Node<P_OUT> evaluate(Spliterator<P_IN> spliterator,
+                         boolean flatten,
+                         IntFunction<P_OUT[]> generator);
 
     /**
      * Collects all output elements resulting from the applying the pipeline
--- a/src/share/classes/java/util/stream/ReferencePipeline.java	Sun Mar 03 20:52:04 2013 -0800
+++ b/src/share/classes/java/util/stream/ReferencePipeline.java	Tue Apr 02 18:57:38 2013 -0400
@@ -92,10 +92,10 @@
     }
 
     @Override
-    protected <P_IN> Node<U> collect(PipelineHelper<P_IN, U> helper,
-                                     Spliterator<P_IN> spliterator,
-                                     boolean flattenTree,
-                                     IntFunction<U[]> generator) {
+    protected <P_IN> Node<U> evaluateToNode(PipelineHelper<P_IN, U> helper,
+                                            Spliterator<P_IN> spliterator,
+                                            boolean flattenTree,
+                                            IntFunction<U[]> generator) {
         return NodeUtils.collect(helper, spliterator, flattenTree, generator);
     }
 
@@ -303,12 +303,12 @@
 
     @Override
     public void forEach(Consumer<? super U> consumer) {
-        pipeline(ForEachOps.makeRef(consumer, false));
+        evaluate(ForEachOps.makeRef(consumer, false));
     }
 
     @Override
     public void forEachOrdered(Consumer<? super U> consumer) {
-        pipeline(ForEachOps.makeRef(consumer, true));
+        evaluate(ForEachOps.makeRef(consumer, true));
     }
 
     @Override
@@ -322,7 +322,7 @@
         // Runtime checking will be performed when an element is stored in A[], thus if A is not a
         // super type of U an ArrayStoreException will be thrown.
         IntFunction rawGenerator = (IntFunction) generator;
-        return (A[]) collectOutput(true, rawGenerator).asArray(rawGenerator);
+        return (A[]) evaluateToArrayNode(rawGenerator).asArray(rawGenerator);
     }
 
     @Override
@@ -332,52 +332,52 @@
 
     @Override
     public boolean anyMatch(Predicate<? super U> predicate) {
-        return pipeline(MatchOps.makeRef(predicate, MatchOps.MatchKind.ANY));
+        return evaluate(MatchOps.makeRef(predicate, MatchOps.MatchKind.ANY));
     }
 
     @Override
     public boolean allMatch(Predicate<? super U> predicate) {
-        return pipeline(MatchOps.makeRef(predicate, MatchOps.MatchKind.ALL));
+        return evaluate(MatchOps.makeRef(predicate, MatchOps.MatchKind.ALL));
     }
 
     @Override
     public boolean noneMatch(Predicate<? super U> predicate) {
-        return pipeline(MatchOps.makeRef(predicate, MatchOps.MatchKind.NONE));
+        return evaluate(MatchOps.makeRef(predicate, MatchOps.MatchKind.NONE));
     }
 
     @Override
     public Optional<U> findFirst() {
-        return pipeline(FindOps.makeRef(true));
+        return evaluate(FindOps.makeRef(true));
     }
 
     @Override
     public Optional<U> findAny() {
-        return pipeline(FindOps.makeRef(false));
+        return evaluate(FindOps.makeRef(false));
     }
 
     @Override
     public U reduce(final U identity, final BinaryOperator<U> accumulator) {
-        return pipeline(ReduceOps.makeRef(identity, accumulator, accumulator));
+        return evaluate(ReduceOps.makeRef(identity, accumulator, accumulator));
     }
 
     @Override
     public Optional<U> reduce(BinaryOperator<U> accumulator) {
-        return pipeline(ReduceOps.makeRef(accumulator));
+        return evaluate(ReduceOps.makeRef(accumulator));
     }
 
     @Override
     public <R> R reduce(R identity, BiFunction<R, ? super U, R> accumulator, BinaryOperator<R> combiner) {
-        return pipeline(ReduceOps.makeRef(identity, accumulator, combiner));
+        return evaluate(ReduceOps.makeRef(identity, accumulator, combiner));
     }
 
     @Override
     public <R> R collect(Collector<? super U, R> collector) {
-        return pipeline(ReduceOps.makeRef(collector));
+        return evaluate(ReduceOps.makeRef(collector));
     }
 
     @Override
     public <R> R collect(Supplier<R> resultFactory, BiConsumer<R, ? super U> accumulator, BiConsumer<R, R> combiner) {
-        return pipeline(ReduceOps.makeRef(resultFactory, accumulator, combiner));
+        return evaluate(ReduceOps.makeRef(resultFactory, accumulator, combiner));
     }
 
     @Override
--- a/src/share/classes/java/util/stream/SortedOp.java	Sun Mar 03 20:52:04 2013 -0800
+++ b/src/share/classes/java/util/stream/SortedOp.java	Tue Apr 02 18:57:38 2013 -0400
@@ -104,11 +104,11 @@
             // If the input is already naturally sorted and this operation
             // naturally sorts then collect the output
             if (StreamOpFlag.SORTED.isKnown(helper.getStreamAndOpFlags()) && isNaturalSort) {
-                return helper.collectOutput(spliterator, false, generator);
+                return helper.evaluate(spliterator, false, generator);
             }
             else {
                 // @@@ Weak two-pass parallel implementation; parallel collect, parallel sort
-                T[] flattenedData = helper.collectOutput(spliterator, true, generator).asArray(generator);
+                T[] flattenedData = helper.evaluate(spliterator, true, generator).asArray(generator);
                 Arrays.parallelSort(flattenedData, comparator);
                 return Nodes.node(flattenedData);
             }
@@ -138,10 +138,10 @@
                                                      Spliterator<P_IN> spliterator,
                                                      IntFunction<Integer[]> generator) {
             if (StreamOpFlag.SORTED.isKnown(helper.getStreamAndOpFlags())) {
-                return helper.collectOutput(spliterator, false, generator);
+                return helper.evaluate(spliterator, false, generator);
             }
             else {
-                Node.OfInt n = (Node.OfInt) helper.collectOutput(spliterator, true, generator);
+                Node.OfInt n = (Node.OfInt) helper.evaluate(spliterator, true, generator);
 
                 int[] content = n.asIntArray();
                 Arrays.parallelSort(content);
@@ -174,10 +174,10 @@
                                                   Spliterator<P_IN> spliterator,
                                                   IntFunction<Long[]> generator) {
             if (StreamOpFlag.SORTED.isKnown(helper.getStreamAndOpFlags())) {
-                return helper.collectOutput(spliterator, false, generator);
+                return helper.evaluate(spliterator, false, generator);
             }
             else {
-                Node.OfLong n = (Node.OfLong) helper.collectOutput(spliterator, true, generator);
+                Node.OfLong n = (Node.OfLong) helper.evaluate(spliterator, true, generator);
 
                 long[] content = n.asLongArray();
                 Arrays.parallelSort(content);
@@ -210,10 +210,10 @@
                                                     Spliterator<P_IN> spliterator,
                                                     IntFunction<Double[]> generator) {
             if (StreamOpFlag.SORTED.isKnown(helper.getStreamAndOpFlags())) {
-                return helper.collectOutput(spliterator, false, generator);
+                return helper.evaluate(spliterator, false, generator);
             }
             else {
-                Node.OfDouble n = (Node.OfDouble) helper.collectOutput(spliterator, true, generator);
+                Node.OfDouble n = (Node.OfDouble) helper.evaluate(spliterator, true, generator);
 
                 double[] content = n.asDoubleArray();
                 Arrays.parallelSort(content);
--- a/test-ng/bootlib/java/util/stream/CollectorOps.java	Sun Mar 03 20:52:04 2013 -0800
+++ b/test-ng/bootlib/java/util/stream/CollectorOps.java	Tue Apr 02 18:57:38 2013 -0400
@@ -73,7 +73,7 @@
         public <P_IN> Node<E_IN> evaluateParallel(PipelineHelper<P_IN, E_IN> helper,
                                                   Spliterator<P_IN> spliterator,
                                                   IntFunction<E_IN[]> generator) {
-            return helper.collectOutput(spliterator, false, generator);
+            return helper.evaluate(spliterator, false, generator);
         }
     }
 
--- a/test-ng/bootlib/java/util/stream/OpTestCase.java	Sun Mar 03 20:52:04 2013 -0800
+++ b/test-ng/bootlib/java/util/stream/OpTestCase.java	Tue Apr 02 18:57:38 2013 -0400
@@ -278,7 +278,7 @@
                 // Induce the reference result
                 before.accept(data);
                 S_OUT sOut = m.apply(data.stream());
-                Node<U> refNodeResult = ((AbstractPipeline<?, U, ?>) sOut).collectOutput(true);
+                Node<U> refNodeResult = ((AbstractPipeline<?, U, ?>) sOut).evaluateToArrayNode(size -> (U[]) new Object[size]);
                 refResult = LambdaTestHelpers.toBoxedList(refNodeResult.spliterator());
                 after.accept(data);
             }
@@ -415,7 +415,7 @@
             AbstractPipeline ap = (AbstractPipeline) out;
             StreamShape shape = ap.getOutputShape();
 
-            Node<U> node = ap.collectOutput(false);
+            Node<U> node = ap.evaluateToArrayNode(size -> (U[]) new Object[size]);
             if (refResult == null) {
                 // Sequentially collect the output that will be input to the terminal op
                 refResult = terminalF.apply((S_OUT) createPipeline(shape, node.spliterator(),
--- a/test-ng/tests/org/openjdk/tests/java/util/stream/SpliteratorTraversingAndSplittingTest.java	Sun Mar 03 20:52:04 2013 -0800
+++ b/test-ng/tests/org/openjdk/tests/java/util/stream/SpliteratorTraversingAndSplittingTest.java	Tue Apr 02 18:57:38 2013 -0400
@@ -376,23 +376,23 @@
             // Collections.synchronized/unmodifiable/checked wrappers
             db.addCollection(Collections::unmodifiableCollection);
             db.addCollection(c -> Collections.unmodifiableSet(new HashSet<>(c)));
-            db.addCollection(c -> Collections.unmodifiableSortedSet(new TreeSet<Integer>(c)));
-            db.addList(c -> Collections.unmodifiableList(new ArrayList(c)));
+            db.addCollection(c -> Collections.unmodifiableSortedSet(new TreeSet<>(c)));
+            db.addList(c -> Collections.unmodifiableList(new ArrayList<>(c)));
             db.addMap(Collections::unmodifiableMap);
             db.addMap(m -> Collections.unmodifiableSortedMap(new TreeMap<>(m)));
 
             db.addCollection(Collections::synchronizedCollection);
             db.addCollection(c -> Collections.synchronizedSet(new HashSet<>(c)));
-            db.addCollection(c -> Collections.synchronizedSortedSet(new TreeSet<Integer>(c)));
-            db.addList(c -> Collections.synchronizedList(new ArrayList(c)));
+            db.addCollection(c -> Collections.synchronizedSortedSet(new TreeSet<>(c)));
+            db.addList(c -> Collections.synchronizedList(new ArrayList<>(c)));
             db.addMap(Collections::synchronizedMap);
             db.addMap(m -> Collections.synchronizedSortedMap(new TreeMap<>(m)));
 
             db.addCollection(c -> Collections.checkedCollection(c, Integer.class));
             db.addCollection(c -> Collections.checkedQueue(new ArrayDeque<>(c), Integer.class));
             db.addCollection(c -> Collections.checkedSet(new HashSet<>(c), Integer.class));
-            db.addCollection(c -> Collections.checkedSortedSet(new TreeSet<Integer>(c), Integer.class));
-            db.addList(c -> Collections.checkedList(new ArrayList(c), Integer.class));
+            db.addCollection(c -> Collections.checkedSortedSet(new TreeSet<>(c), Integer.class));
+            db.addList(c -> Collections.checkedList(new ArrayList<>(c), Integer.class));
             db.addMap(c -> Collections.checkedMap(c, Integer.class, Integer.class));
             db.addMap(m -> Collections.checkedSortedMap(new TreeMap<>(m), Integer.class, Integer.class));