changeset 7357:bb3af89c6549

Rename forEachUntil to forEachUntilCancelled
author briangoetz
date Tue, 19 Feb 2013 18:41:43 -0500
parents c68ca847f63a
children 8ecb70e1f9ab
files src/share/classes/java/util/stream/DelegatingStream.java src/share/classes/java/util/stream/DoublePipeline.java src/share/classes/java/util/stream/DoubleStream.java src/share/classes/java/util/stream/IntPipeline.java src/share/classes/java/util/stream/IntStream.java src/share/classes/java/util/stream/LongPipeline.java src/share/classes/java/util/stream/LongStream.java src/share/classes/java/util/stream/ReferencePipeline.java src/share/classes/java/util/stream/Stream.java test-ng/tests/org/openjdk/tests/java/util/stream/ForEachOpTest.java test-ng/tests/org/openjdk/tests/java/util/stream/SortedOpTest.java test/java/util/stream/Stream/IntegerStreamTest.java
diffstat 12 files changed, 31 insertions(+), 31 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/java/util/stream/DelegatingStream.java	Tue Feb 19 17:31:24 2013 -0500
+++ b/src/share/classes/java/util/stream/DelegatingStream.java	Tue Feb 19 18:41:43 2013 -0500
@@ -134,8 +134,8 @@
         delegate.forEach(consumer);
     }
 
-    public void forEachUntil(Consumer<? super T> consumer, BooleanSupplier until) {
-        delegate.forEachUntil(consumer, until);
+    public void forEachUntilCancelled(Consumer<? super T> consumer, BooleanSupplier cancelledFunction) {
+        delegate.forEachUntilCancelled(consumer, cancelledFunction);
     }
 
     public Stream<T> peek(Consumer<? super T> consumer) {
--- a/src/share/classes/java/util/stream/DoublePipeline.java	Tue Feb 19 17:31:24 2013 -0500
+++ b/src/share/classes/java/util/stream/DoublePipeline.java	Tue Feb 19 18:41:43 2013 -0500
@@ -222,7 +222,7 @@
     }
 
     @Override
-    public void forEachUntil(DoubleConsumer consumer, BooleanSupplier until) {
+    public void forEachUntilCancelled(DoubleConsumer consumer, BooleanSupplier until) {
         pipeline(ForEachUntilOp.make(consumer, until));
     }
 
--- a/src/share/classes/java/util/stream/DoubleStream.java	Tue Feb 19 17:31:24 2013 -0500
+++ b/src/share/classes/java/util/stream/DoubleStream.java	Tue Feb 19 18:41:43 2013 -0500
@@ -108,7 +108,7 @@
 
     void forEach(DoubleConsumer consumer);
 
-    void forEachUntil(DoubleConsumer consumer, BooleanSupplier until);
+    void forEachUntilCancelled(DoubleConsumer consumer, BooleanSupplier until);
 
     default double sum() {
         // better algorithm to compensate for errors ?
--- a/src/share/classes/java/util/stream/IntPipeline.java	Tue Feb 19 17:31:24 2013 -0500
+++ b/src/share/classes/java/util/stream/IntPipeline.java	Tue Feb 19 18:41:43 2013 -0500
@@ -244,7 +244,7 @@
     }
 
     @Override
-    public void forEachUntil(IntConsumer consumer, BooleanSupplier until) {
+    public void forEachUntilCancelled(IntConsumer consumer, BooleanSupplier until) {
         pipeline(ForEachUntilOp.make(consumer, until));
     }
 
--- a/src/share/classes/java/util/stream/IntStream.java	Tue Feb 19 17:31:24 2013 -0500
+++ b/src/share/classes/java/util/stream/IntStream.java	Tue Feb 19 18:41:43 2013 -0500
@@ -165,7 +165,7 @@
 
     void forEach(IntConsumer consumer);
 
-    void forEachUntil(IntConsumer consumer, BooleanSupplier until);
+    void forEachUntilCancelled(IntConsumer consumer, BooleanSupplier until);
 
     default int sum() {
         return reduce(0, Integer::sum);
--- a/src/share/classes/java/util/stream/LongPipeline.java	Tue Feb 19 17:31:24 2013 -0500
+++ b/src/share/classes/java/util/stream/LongPipeline.java	Tue Feb 19 18:41:43 2013 -0500
@@ -234,7 +234,7 @@
     }
 
     @Override
-    public void forEachUntil(LongConsumer consumer, BooleanSupplier until) {
+    public void forEachUntilCancelled(LongConsumer consumer, BooleanSupplier until) {
         pipeline(ForEachUntilOp.make(consumer, until));
     }
 
--- a/src/share/classes/java/util/stream/LongStream.java	Tue Feb 19 17:31:24 2013 -0500
+++ b/src/share/classes/java/util/stream/LongStream.java	Tue Feb 19 18:41:43 2013 -0500
@@ -111,7 +111,7 @@
 
     void forEach(LongConsumer consumer);
 
-    void forEachUntil(LongConsumer consumer, BooleanSupplier until);
+    void forEachUntilCancelled(LongConsumer consumer, BooleanSupplier until);
 
     default long sum() {
         // @@@ better algorithm to compensate for intermediate overflow?
--- a/src/share/classes/java/util/stream/ReferencePipeline.java	Tue Feb 19 17:31:24 2013 -0500
+++ b/src/share/classes/java/util/stream/ReferencePipeline.java	Tue Feb 19 18:41:43 2013 -0500
@@ -231,8 +231,8 @@
     }
 
     @Override
-    public void forEachUntil(Consumer<? super U> consumer, BooleanSupplier until) {
-        pipeline(ForEachUntilOp.make(consumer, until));
+    public void forEachUntilCancelled(Consumer<? super U> consumer, BooleanSupplier cancelledFunction) {
+        pipeline(ForEachUntilOp.make(consumer, cancelledFunction));
     }
 
     @Override
--- a/src/share/classes/java/util/stream/Stream.java	Tue Feb 19 17:31:24 2013 -0500
+++ b/src/share/classes/java/util/stream/Stream.java	Tue Feb 19 18:41:43 2013 -0500
@@ -227,11 +227,11 @@
      * shared state, it is responsible for providing the required synchronization.
      *
      * @param consumer The {@code Consumer} to receive the elements
-     * @param until A {@code BooleanSupplier} that indicates whether the termination criteria has occurred.  Once
-     *              it returns @{code true} the first time, it must continue to return {@code true} for all future
-     *              invocations
+     * @param cancelledFunction A {@code BooleanSupplier} that indicates whether the termination criteria has occurred.
+     *                          Once it returns @{code true} the first time, it must continue to return {@code true}
+     *                          for all future invocations
      */
-    void forEachUntil(Consumer<? super T> consumer, BooleanSupplier until);
+    void forEachUntilCancelled(Consumer<? super T> consumer, BooleanSupplier cancelledFunction);
 
     /**
      * Produce a {@code Stream} containing the elements of this stream, and also provide elements
--- a/test-ng/tests/org/openjdk/tests/java/util/stream/ForEachOpTest.java	Tue Feb 19 17:31:24 2013 -0500
+++ b/test-ng/tests/org/openjdk/tests/java/util/stream/ForEachOpTest.java	Tue Feb 19 18:41:43 2013 -0500
@@ -88,9 +88,9 @@
     
     public void testUntil() {
         this.<Integer>testUntil(UNTIL_SIZE, (c, e) -> Streams.intRange(0, UNTIL_SIZE).
-                boxed().peek(c).forEachUntil(i -> {}, e));
+                boxed().peek(c).forEachUntilCancelled(i -> {}, e));
         this.<Integer>testUntil(UNTIL_SIZE, (c, e) -> Streams.intRange(0, UNTIL_SIZE).parallel().
-                boxed().peek(c).forEachUntil(i -> {}, e));
+                boxed().peek(c).forEachUntilCancelled(i -> {}, e));
     }
 
     //
@@ -109,9 +109,9 @@
 
     public void testIntUntil() {
         this.<Integer>testUntil(UNTIL_SIZE, (c, e) -> Streams.intRange(0, UNTIL_SIZE).
-                peek(c::accept).forEachUntil(i -> {}, e));
+                peek(c::accept).forEachUntilCancelled(i -> {}, e));
         this.<Integer>testUntil(UNTIL_SIZE, (c, e) -> Streams.intRange(0, UNTIL_SIZE).parallel().
-                peek(c::accept).forEachUntil(i -> {}, e));
+                peek(c::accept).forEachUntilCancelled(i -> {}, e));
     }
 
     //
@@ -130,9 +130,9 @@
 
     public void testLongUntil() {
         this.<Long>testUntil(UNTIL_SIZE, (c, e) -> Streams.longRange(0, UNTIL_SIZE).
-                peek(c::accept).forEachUntil(i -> {}, e));
+                peek(c::accept).forEachUntilCancelled(i -> {}, e));
         this.<Long>testUntil(UNTIL_SIZE, (c, e) -> Streams.longRange(0, UNTIL_SIZE).parallel().
-                peek(c::accept).forEachUntil(i -> {}, e));
+                peek(c::accept).forEachUntilCancelled(i -> {}, e));
     }
 
     //
@@ -151,8 +151,8 @@
 
     public void testDoubleUntil() {
         this.<Double>testUntil(UNTIL_SIZE, (c, e) -> Streams.longRange(0, UNTIL_SIZE).doubles().
-                peek(c::accept).forEachUntil(i -> {}, e));
+                peek(c::accept).forEachUntilCancelled(i -> {}, e));
         this.<Double>testUntil(UNTIL_SIZE, (c, e) -> Streams.longRange(0, UNTIL_SIZE).parallel().doubles().
-                peek(c::accept).forEachUntil(i -> {}, e));
+                peek(c::accept).forEachUntilCancelled(i -> {}, e));
     }
 }
--- a/test-ng/tests/org/openjdk/tests/java/util/stream/SortedOpTest.java	Tue Feb 19 17:31:24 2013 -0500
+++ b/test-ng/tests/org/openjdk/tests/java/util/stream/SortedOpTest.java	Tue Feb 19 18:41:43 2013 -0500
@@ -72,7 +72,7 @@
         {
             List<Integer> teeList = new ArrayList<>();
             List<Integer> forEachUntilList = new ArrayList<>();
-            l.stream().peek(teeList::add).sorted(LambdaTestHelpers.cInteger).forEachUntil(forEachUntilList::add, () -> teeList.size() > 1);
+            l.stream().peek(teeList::add).sorted(LambdaTestHelpers.cInteger).forEachUntilCancelled(forEachUntilList::add, () -> teeList.size() > 1);
             assertEquals(teeList.size(), 2);
             assertEquals(forEachUntilList.size(), 2);
             assertEquals(teeList, Arrays.asList(5, 4));
@@ -82,7 +82,7 @@
         {
             List<Integer> teeList = new ArrayList<>();
             List<Integer> forEachUntilList = new ArrayList<>();
-            unknownSizeStream(l).peek(teeList::add).sorted(LambdaTestHelpers.cInteger).forEachUntil(forEachUntilList::add, () -> teeList.size() > 1);
+            unknownSizeStream(l).peek(teeList::add).sorted(LambdaTestHelpers.cInteger).forEachUntilCancelled(forEachUntilList::add, () -> teeList.size() > 1);
             assertEquals(teeList.size(), 2);
             assertEquals(forEachUntilList.size(), 2);
             assertEquals(teeList, Arrays.asList(5, 4));
@@ -138,7 +138,7 @@
         {
             List<Integer> teeList = new ArrayList<>();
             List<Integer> forEachUntilList = new ArrayList<>();
-            Arrays.stream(a).peek(teeList::add).sorted().forEachUntil(forEachUntilList::add, () -> teeList.size() > 1);
+            Arrays.stream(a).peek(teeList::add).sorted().forEachUntilCancelled(forEachUntilList::add, () -> teeList.size() > 1);
             assertEquals(teeList.size(), 2);
             assertEquals(forEachUntilList.size(), 2);
             assertEquals(teeList, Arrays.asList(5, 4));
@@ -148,7 +148,7 @@
         {
             List<Integer> teeList = new ArrayList<>();
             List<Integer> forEachUntilList = new ArrayList<>();
-            unknownSizeIntStream(a).peek(teeList::add).sorted().forEachUntil(forEachUntilList::add, () -> teeList.size() > 1);
+            unknownSizeIntStream(a).peek(teeList::add).sorted().forEachUntilCancelled(forEachUntilList::add, () -> teeList.size() > 1);
             assertEquals(teeList.size(), 2);
             assertEquals(forEachUntilList.size(), 2);
             assertEquals(teeList, Arrays.asList(5, 4));
@@ -201,7 +201,7 @@
         {
             List<Long> teeList = new ArrayList<>();
             List<Long> forEachUntilList = new ArrayList<>();
-            Arrays.stream(a).peek(teeList::add).sorted().forEachUntil(forEachUntilList::add, () -> teeList.size() > 1);
+            Arrays.stream(a).peek(teeList::add).sorted().forEachUntilCancelled(forEachUntilList::add, () -> teeList.size() > 1);
             assertEquals(teeList.size(), 2);
             assertEquals(forEachUntilList.size(), 2);
             assertEquals(teeList, Arrays.asList(5L, 4L));
@@ -211,7 +211,7 @@
         {
             List<Long> teeList = new ArrayList<>();
             List<Long> forEachUntilList = new ArrayList<>();
-            unknownSizeLongStream(a).peek(teeList::add).sorted().forEachUntil(forEachUntilList::add, () -> teeList.size() > 1);
+            unknownSizeLongStream(a).peek(teeList::add).sorted().forEachUntilCancelled(forEachUntilList::add, () -> teeList.size() > 1);
             assertEquals(teeList.size(), 2);
             assertEquals(forEachUntilList.size(), 2);
             assertEquals(teeList, Arrays.asList(5L, 4L));
@@ -264,7 +264,7 @@
         {
             List<Double> teeList = new ArrayList<>();
             List<Double> forEachUntilList = new ArrayList<>();
-            Arrays.stream(a).peek(teeList::add).sorted().forEachUntil(forEachUntilList::add, () -> teeList.size() > 1);
+            Arrays.stream(a).peek(teeList::add).sorted().forEachUntilCancelled(forEachUntilList::add, () -> teeList.size() > 1);
             assertEquals(teeList.size(), 2);
             assertEquals(forEachUntilList.size(), 2);
             assertEquals(teeList, Arrays.asList(5.0, 4.0));
@@ -274,7 +274,7 @@
         {
             List<Double> teeList = new ArrayList<>();
             List<Double> forEachUntilList = new ArrayList<>();
-            unknownSizeDoubleStream(a).peek(teeList::add).sorted().forEachUntil(forEachUntilList::add, () -> teeList.size() > 1);
+            unknownSizeDoubleStream(a).peek(teeList::add).sorted().forEachUntilCancelled(forEachUntilList::add, () -> teeList.size() > 1);
             assertEquals(teeList.size(), 2);
             assertEquals(forEachUntilList.size(), 2);
             assertEquals(teeList, Arrays.asList(5.0, 4.0));
--- a/test/java/util/stream/Stream/IntegerStreamTest.java	Tue Feb 19 17:31:24 2013 -0500
+++ b/test/java/util/stream/Stream/IntegerStreamTest.java	Tue Feb 19 18:41:43 2013 -0500
@@ -387,7 +387,7 @@
         Stream<Integer> stream1 = (type == ParallelType.Parallel) ? c.parallelStream():
                                   (type == ParallelType.Sequential) ? c.stream().sequential() :
                                   c.stream();
-        stream1.forEachUntil(t -> cLimit.add(t), () -> cLimit.size() == limit);
+        stream1.forEachUntilCancelled(t -> cLimit.add(t), () -> cLimit.size() == limit);
         assertEquals(cLimit.size(), limit);
     }