8019551: Make BaseStream public
authorpsandoz
Tue, 09 Jul 2013 10:44:49 +0200
changeset 18789 b518cd4045bc
parent 18788 1bfd5f623662
child 18790 d25399d849bc
8019551: Make BaseStream public Reviewed-by: chegar, psandoz Contributed-by: brian goetz <brian.goetz@oracle.com>
jdk/src/share/classes/java/util/stream/AbstractPipeline.java
jdk/src/share/classes/java/util/stream/BaseStream.java
--- a/jdk/src/share/classes/java/util/stream/AbstractPipeline.java	Tue Jul 09 09:15:57 2013 +0200
+++ b/jdk/src/share/classes/java/util/stream/AbstractPipeline.java	Tue Jul 09 10:44:49 2013 +0200
@@ -53,11 +53,6 @@
  * operation, the stream is considered to be consumed, and no more intermediate
  * or terminal operations are permitted on this stream instance.
  *
- * <p>{@code AbstractPipeline} implements a number of methods that are
- * specified in {@link BaseStream}, though it does not implement
- * {@code BaseStream} directly.  Subclasses of {@code AbstractPipeline}
- * will generally implement {@code BaseStream}.
- *
  * @implNote
  * <p>For sequential streams, and parallel streams without
  * <a href="package-summary.html#StreamOps">stateful intermediate
@@ -75,7 +70,7 @@
  * @since 1.8
  */
 abstract class AbstractPipeline<E_IN, E_OUT, S extends BaseStream<E_OUT, S>>
-        extends PipelineHelper<E_OUT> {
+        extends PipelineHelper<E_OUT> implements BaseStream<E_OUT, S> {
     /**
      * Backlink to the head of the pipeline chain (self if this is the source
      * stage).
@@ -286,26 +281,20 @@
 
     // BaseStream
 
-    /**
-     * Implements {@link BaseStream#sequential()}
-     */
+    @Override
     public final S sequential() {
         sourceStage.parallel = false;
         return (S) this;
     }
 
-    /**
-     * Implements {@link BaseStream#parallel()}
-     */
+    @Override
     public final S parallel() {
         sourceStage.parallel = true;
         return (S) this;
     }
 
     // Primitive specialization use co-variant overrides, hence is not final
-    /**
-     * Implements {@link BaseStream#spliterator()}
-     */
+    @Override
     public Spliterator<E_OUT> spliterator() {
         if (linkedOrConsumed)
             throw new IllegalStateException("stream has already been operated upon");
@@ -331,9 +320,7 @@
         }
     }
 
-    /**
-     * Implements {@link BaseStream#isParallel()}
-     */
+    @Override
     public final boolean isParallel() {
         return sourceStage.parallel;
     }
--- a/jdk/src/share/classes/java/util/stream/BaseStream.java	Tue Jul 09 09:15:57 2013 +0200
+++ b/jdk/src/share/classes/java/util/stream/BaseStream.java	Tue Jul 09 10:44:49 2013 +0200
@@ -29,15 +29,13 @@
 
 /**
  * Base interface for stream types such as {@link Stream}, {@link IntStream},
- * etc.  Contains methods common to all stream types.  Many of these methods
- * are implemented by {@link AbstractPipeline}, even though
- * {@code AbstractPipeline} does not directly implement {@code BaseStream}.
+ * etc.  Contains methods common to all stream types.
  *
  * @param <T> type of stream elements
  * @param <S> type of stream implementing {@code BaseStream}
  * @since 1.8
  */
-interface BaseStream<T, S extends BaseStream<T, S>> {
+public interface BaseStream<T, S extends BaseStream<T, S>> {
     /**
      * Returns an iterator for the elements of this stream.
      *