E_IN
- type of elements in the upstream sourcepublic static class IntPipeline.Head<E_IN> extends IntPipeline<E_IN>
IntPipeline.Head<E_IN>, IntPipeline.StatefulOp<E_IN>, IntPipeline.StatelessOp<E_IN>
IntStream.Builder
sourceOrOpFlags
Constructor and Description |
---|
Head(Spliterator<Integer> source,
int sourceFlags,
boolean parallel)
Constructor for the source stage of an IntStream.
|
Head(Supplier<? extends Spliterator<Integer>> source,
int sourceFlags,
boolean parallel)
Constructor for the source stage of an IntStream.
|
Modifier and Type | Method and Description |
---|---|
void |
forEach(IntConsumer action)
Performs an action for each element of this stream.
|
void |
forEachOrdered(IntConsumer action)
Performs an action for each element of this stream, guaranteeing that
each element is processed in encounter order for streams that have a
defined encounter order.
|
boolean |
opIsStateful()
Returns whether this operation is stateful or not.
|
Sink<E_IN> |
opWrapSink(int flags,
Sink<Integer> sink)
Accepts a
Sink which will receive the results of this operation,
and return a Sink which accepts elements of the input type of
this operation and which performs the operation, passing the results to
the provided Sink . |
allMatch, anyMatch, asDoubleStream, asLongStream, average, boxed, collect, count, distinct, evaluateToNode, filter, findAny, findFirst, flatMap, forEachWithCancel, getOutputShape, iterator, lazySpliterator, limit, makeNodeBuilder, map, mapToDouble, mapToLong, mapToObj, max, min, noneMatch, peek, reduce, reduce, skip, sorted, spliterator, sum, summaryStatistics, toArray, unordered, wrap
close, evaluate, evaluateToArrayNode, getStreamAndOpFlags, getStreamFlags, isParallel, onClose, opEvaluateParallel, opEvaluateParallelLazy, parallel, sequential, wrapSink
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
builder, concat, empty, generate, iterate, of, of, parallel, range, rangeClosed, sequential
close, isParallel, onClose
public Head(Supplier<? extends Spliterator<Integer>> source, int sourceFlags, boolean parallel)
source
- Supplier<Spliterator>
describing the stream
sourcesourceFlags
- the source flags for the stream source, described
in StreamOpFlag
parallel
- true
if the pipeline is parallelpublic Head(Spliterator<Integer> source, int sourceFlags, boolean parallel)
source
- Spliterator
describing the stream sourcesourceFlags
- the source flags for the stream source, described
in StreamOpFlag
parallel
- true
if the pipeline is parallelpublic final boolean opIsStateful()
AbstractPipeline
AbstractPipeline.opEvaluateParallel(PipelineHelper, java.util.Spliterator, java.util.function.IntFunction)
must be overridden.opIsStateful
in class AbstractPipeline<E_IN,Integer,IntStream>
true
if this operation is statefulpublic final Sink<E_IN> opWrapSink(int flags, Sink<Integer> sink)
AbstractPipeline
Sink
which will receive the results of this operation,
and return a Sink
which accepts elements of the input type of
this operation and which performs the operation, passing the results to
the provided Sink
.opWrapSink
in class AbstractPipeline<E_IN,Integer,IntStream>
flags
- The combined stream and operation flags up to, but not
including, this operationsink
- sink to which elements should be sent after processingSink
.public void forEach(IntConsumer action)
IntStream
This is a terminal operation.
For parallel stream pipelines, this operation does not guarantee to respect the encounter order of the stream, as doing so would sacrifice the benefit of parallelism. For any given element, the action may be performed at whatever time and in whatever thread the library chooses. If the action accesses shared state, it is responsible for providing the required synchronization.
forEach
in interface IntStream
forEach
in class IntPipeline<E_IN>
action
- a
non-interfering action to perform on the elementspublic void forEachOrdered(IntConsumer action)
IntStream
This is a terminal operation.
forEachOrdered
in interface IntStream
forEachOrdered
in class IntPipeline<E_IN>
action
- a
non-interfering action to perform on the elementsIntStream.forEach(IntConsumer)