changeset 6341:93ea6cccef22

Fix a number of minor issues with missing begin()/end()/build()
author mduigou
date Tue, 23 Oct 2012 14:06:54 -0700
parents f0ca8e57004a
children 87a48add175b
files src/share/classes/java/util/streams/ops/CumulateOp.java src/share/classes/java/util/streams/ops/NodeBuilder.java test-ng/tests/org/openjdk/tests/java/util/streams/ops/NodeBuilderTest.java test-ng/tests/org/openjdk/tests/java/util/streams/ops/NodeTest.java test-ng/tests/org/openjdk/tests/java/util/streams/ops/ToArrayOpTest.java
diffstat 5 files changed, 13 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/java/util/streams/ops/CumulateOp.java	Mon Oct 22 14:11:06 2012 -0700
+++ b/src/share/classes/java/util/streams/ops/CumulateOp.java	Tue Oct 23 14:06:54 2012 -0700
@@ -74,6 +74,11 @@
             }
 
             @Override
+            public void end() {
+                sink.end();
+            }
+
+            @Override
             public T getAndClearState() {
                 T ret = state;
                 state = null;
--- a/src/share/classes/java/util/streams/ops/NodeBuilder.java	Mon Oct 22 14:11:06 2012 -0700
+++ b/src/share/classes/java/util/streams/ops/NodeBuilder.java	Tue Oct 23 14:06:54 2012 -0700
@@ -24,7 +24,6 @@
  */
 package java.util.streams.ops;
 
-import java.util.Collection;
 import java.util.Sized;
 import java.util.Traversable;
 import java.util.functions.UnaryOperator;
--- a/test-ng/tests/org/openjdk/tests/java/util/streams/ops/NodeBuilderTest.java	Mon Oct 22 14:11:06 2012 -0700
+++ b/test-ng/tests/org/openjdk/tests/java/util/streams/ops/NodeBuilderTest.java	Tue Oct 23 14:06:54 2012 -0700
@@ -73,9 +73,11 @@
     @Test(dataProvider = "sizes")
     public void testIteration(List<Integer> l, Mapper<Integer, NodeBuilder<Integer>> m) {
         NodeBuilder<Integer> nb = m.map(l.size());
+        nb.begin(l.size());
         for (int i : l) {
             nb.accept(i);
         }
+        nb.end();
 
         assertEquals(nb.size(), l.size());
 
@@ -101,9 +103,11 @@
     @Test(dataProvider = "sizes")
     public void testUpdate(List<Integer> l, Mapper<Integer, NodeBuilder<Integer>> m) {
         NodeBuilder<Integer> nb = m.map(l.size());
+        nb.begin(l.size());
         for (int i : l) {
             nb.accept(i);
         }
+        nb.end();
 
         // Negate each element
         nb.forEachUpdate(e -> -e);
--- a/test-ng/tests/org/openjdk/tests/java/util/streams/ops/NodeTest.java	Mon Oct 22 14:11:06 2012 -0700
+++ b/test-ng/tests/org/openjdk/tests/java/util/streams/ops/NodeTest.java	Tue Oct 23 14:06:54 2012 -0700
@@ -73,9 +73,11 @@
     }
 
     Node<Integer> fill(Integer[] array, NodeBuilder<Integer> nb) {
+        nb.begin(array.length);
         for (Integer i : array) {
             nb.accept(i);
         }
+        nb.end();
         return nb.build();
     }
 
--- a/test-ng/tests/org/openjdk/tests/java/util/streams/ops/ToArrayOpTest.java	Mon Oct 22 14:11:06 2012 -0700
+++ b/test-ng/tests/org/openjdk/tests/java/util/streams/ops/ToArrayOpTest.java	Tue Oct 23 14:06:54 2012 -0700
@@ -133,9 +133,11 @@
 
         {
             NodeBuilder<Integer> nodeBuilder = Nodes.makeVariableSizeBuilder();
+            nodeBuilder.begin(l.size());
             for (Integer i : l) {
                 nodeBuilder.accept(i);
             }
+            nodeBuilder.end();
             Object[] output = new ValuePipeline<>(Nodes.toStreamAccessor(nodeBuilder.build())).toArray();
             assertEquals(Arrays.asList(output), l);
         }