int characteristics, boolean parallel) { return new DoublePipeline.Head<>(supplier, StreamOpFlag.fromCharacteristics(characteristics), parallel);
@Override public void forEach(DoubleConsumer consumer) { if (!isParallel()) { adapt(sourceStageSpliterator()).forEachRemaining(consumer); } else { super.forEach(consumer); } }
int characteristics, boolean parallel) { return new DoublePipeline.Head<>(supplier, StreamOpFlag.fromCharacteristics(characteristics), parallel);
/** * Creates a new sequential or parallel {@code DoubleStream} from a * {@code Spliterator.OfDouble}. * * <p>The spliterator is only traversed, split, or queried for estimated size * after the terminal operation of the stream pipeline commences. * * <p>It is strongly recommended the spliterator report a characteristic of * {@code IMMUTABLE} or {@code CONCURRENT}, or be * <a href="../Spliterator.html#binding">late-binding</a>. Otherwise, * {@link #doubleStream(java8.util.function.Supplier, int, boolean)} should * be used to reduce the scope of potential interference with the source. See * <a href="package-summary.html#NonInterference">Non-Interference</a> for * more details. * * @param spliterator A {@code Spliterator.OfDouble} describing the stream elements * @param parallel if {@code true} then the returned stream is a parallel * stream; if {@code false} the returned stream is a sequential * stream. * @return a new sequential or parallel {@code DoubleStream} */ public static DoubleStream doubleStream(Spliterator.OfDouble spliterator, boolean parallel) { return new DoublePipeline.Head<>(spliterator, StreamOpFlag.fromCharacteristics(spliterator), parallel); }
/** * Creates a new sequential or parallel {@code DoubleStream} from a * {@code Spliterator.OfDouble}. * * <p>The spliterator is only traversed, split, or queried for estimated size * after the terminal operation of the stream pipeline commences. * * <p>It is strongly recommended the spliterator report a characteristic of * {@code IMMUTABLE} or {@code CONCURRENT}, or be * <a href="../Spliterator.html#binding">late-binding</a>. Otherwise, * {@link #doubleStream(java8.util.function.Supplier, int, boolean)} should * be used to reduce the scope of potential interference with the source. See * <a href="package-summary.html#NonInterference">Non-Interference</a> for * more details. * * @param spliterator A {@code Spliterator.OfDouble} describing the stream elements * @param parallel if {@code true} then the returned stream is a parallel * stream; if {@code false} the returned stream is a sequential * stream. * @return a new sequential or parallel {@code DoubleStream} */ public static DoubleStream doubleStream(Spliterator.OfDouble spliterator, boolean parallel) { return new DoublePipeline.Head<>(spliterator, StreamOpFlag.fromCharacteristics(spliterator), parallel); }
@Override public void forEachOrdered(DoubleConsumer consumer) { if (!isParallel()) { adapt(sourceStageSpliterator()).forEachRemaining(consumer); } else { super.forEachOrdered(consumer); } }
@Override public void forEach(DoubleConsumer consumer) { if (!isParallel()) { adapt(sourceStageSpliterator()).forEachRemaining(consumer); } else { super.forEach(consumer); } }
@Override public void forEachOrdered(DoubleConsumer consumer) { if (!isParallel()) { adapt(sourceStageSpliterator()).forEachRemaining(consumer); } else { super.forEachOrdered(consumer); } }