src/share/classes/java/util/stream/AbstractPipeline.java

Print this page
rev 7619 : 8019551: Make BaseStream public
Reviewed-by:

*** 51,65 **** * * <p>After chaining a new intermediate operation, or executing a terminal * 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 * operations</a>, parallel streams, pipeline evaluation is done in a single * pass that "jams" all the operations together. For parallel streams with --- 51,60 ----
*** 73,83 **** * @param <E_OUT> type of output elements * @param <S> type of the subclass implementing {@code BaseStream} * @since 1.8 */ abstract class AbstractPipeline<E_IN, E_OUT, S extends BaseStream<E_OUT, S>> ! extends PipelineHelper<E_OUT> { /** * Backlink to the head of the pipeline chain (self if this is the source * stage). */ private final AbstractPipeline sourceStage; --- 68,78 ---- * @param <E_OUT> type of output elements * @param <S> type of the subclass implementing {@code BaseStream} * @since 1.8 */ abstract class AbstractPipeline<E_IN, E_OUT, S extends BaseStream<E_OUT, S>> ! extends PipelineHelper<E_OUT> implements BaseStream<E_OUT, S> { /** * Backlink to the head of the pipeline chain (self if this is the source * stage). */ private final AbstractPipeline sourceStage;
*** 284,313 **** } } // BaseStream ! /** ! * Implements {@link BaseStream#sequential()} ! */ public final S sequential() { sourceStage.parallel = false; return (S) this; } ! /** ! * Implements {@link BaseStream#parallel()} ! */ public final S parallel() { sourceStage.parallel = true; return (S) this; } // Primitive specialization use co-variant overrides, hence is not final ! /** ! * Implements {@link BaseStream#spliterator()} ! */ public Spliterator<E_OUT> spliterator() { if (linkedOrConsumed) throw new IllegalStateException("stream has already been operated upon"); linkedOrConsumed = true; --- 279,302 ---- } } // BaseStream ! @Override public final S sequential() { sourceStage.parallel = false; return (S) this; } ! @Override public final S parallel() { sourceStage.parallel = true; return (S) this; } // Primitive specialization use co-variant overrides, hence is not final ! @Override public Spliterator<E_OUT> spliterator() { if (linkedOrConsumed) throw new IllegalStateException("stream has already been operated upon"); linkedOrConsumed = true;
*** 329,341 **** else { return wrap(this, () -> sourceSpliterator(0), isParallel()); } } ! /** ! * Implements {@link BaseStream#isParallel()} ! */ public final boolean isParallel() { return sourceStage.parallel; } --- 318,328 ---- else { return wrap(this, () -> sourceSpliterator(0), isParallel()); } } ! @Override public final boolean isParallel() { return sourceStage.parallel; }