TerminalOp that perform an
action for every element of a stream. Supported variants include unordered
traversal (elements are provided to the Consumer as soon as they are
available), and ordered traversal (elements are provided to the
Consumer in encounter order.)
Elements are provided to the Consumer on whatever thread and
whatever order they become available. For ordered traversals, it is
guaranteed that processing an element happens-before processing
subsequent elements in the encounter order.
Exceptions occurring as a result of sending an element to the
Consumer will be relayed to the caller and traversal will be
prematurely terminated.
| Modifier and Type | Class and Description |
|---|---|
| pack-priv abstract static class | ForEachOps.
the output type of the stream pipeline T>A |
| pack-priv static class | ForEachOps.
A |
| pack-priv static class |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static TerminalOp | Returns: theTerminalOp instancethe action, boolean DoubleConsumer that receives all elements of
a streamwhether an ordered traversal is requested ordered)Constructs a |
| public static TerminalOp | Returns: theTerminalOp instancethe action, boolean IntConsumer that receives all elements of a
streamwhether an ordered traversal is requested ordered)Constructs a |
| public static TerminalOp | Returns: theTerminalOp instancethe action, boolean LongConsumer that receives all elements of a
streamwhether an ordered traversal is requested ordered)Constructs a |
| public static < the type of the stream elements T> TerminalOp |
| ForEachOps | back to summary |
|---|---|
| private ForEachOps() | |
| makeDouble | back to summary |
|---|---|
| public static TerminalOp Constructs a
| |
| makeInt | back to summary |
|---|---|
| public static TerminalOp Constructs a
| |
| makeLong | back to summary |
|---|---|
| public static TerminalOp Constructs a
| |
| makeRef | back to summary |
|---|---|
| public static <T> TerminalOp Constructs a
| |
TerminalOp that evaluates a stream pipeline and sends the
output to itself as a TerminalSink. Elements will be sent in
whatever thread they become available. If the traversal is unordered,
they will be sent independent of the stream's encounter order.
This terminal operation is stateless. For parallel evaluation, each
leaf instance of a ForEachTask will send elements to the same
TerminalSink reference that is an instance of this class.
| Modifier and Type | Class and Description |
|---|---|
| pack-priv static class | ForEachOps.
Implementation class for |
| pack-priv static class | ForEachOps.
Implementation class for |
| pack-priv static class | ForEachOps.
Implementation class for |
| pack-priv static class |
| Modifier and Type | Field and Description |
|---|---|
| private final boolean |
| Access | Constructor and Description |
|---|---|
| protected |
| Modifier and Type | Method and Description |
|---|---|
| public <S> Void | evaluateParallel(PipelineHelper<T> helper, Spliterator<S> spliterator)
Overrides default java. Performs a parallel evaluation of the operation using the specified
|
| public <S> Void | evaluateSequential(PipelineHelper<T> helper, Spliterator<S> spliterator)
Implements java. Performs a sequential evaluation of the operation using the specified
|
| public Void | |
| public int | getOpFlags()
Overrides default java. Gets the stream flags of the operation. |
| ordered | back to summary |
|---|---|
| private final boolean ordered | |
| ForEachOp | back to summary |
|---|---|
| protected ForEachOp(boolean ordered) | |
| evaluateParallel | back to summary |
|---|---|
| public <S> Void evaluateParallel(PipelineHelper<T> helper, Spliterator<S> spliterator) Overrides default java. Doc from java. Performs a parallel evaluation of the operation using the specified
| |
| evaluateSequential | back to summary |
|---|---|
| public <S> Void evaluateSequential(PipelineHelper<T> helper, Spliterator<S> spliterator) Implements java. Doc from java. Performs a sequential evaluation of the operation using the specified
| |
| get | back to summary |
|---|---|
| public Void get() Implements java. Doc from java. Gets a result.
| |
| getOpFlags | back to summary |
|---|---|
| public int getOpFlags() Overrides default java. Doc from java. Gets the stream flags of the operation. Terminal operations may set a
limited subset of the stream flags defined in
| |
DoubleStream
| Modifier and Type | Field and Description |
|---|---|
| pack-priv final DoubleConsumer |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public void | accept(double t)
Overrides default java. Implements java. Accepts a double value. |
| public StreamShape | inputShape()
Overrides default java. Gets the shape of the input type of this operation. |
| consumer | back to summary |
|---|---|
| pack-priv final DoubleConsumer consumer | |
| OfDouble | back to summary |
|---|---|
| pack-priv OfDouble(DoubleConsumer consumer, boolean ordered) | |
| accept | back to summary |
|---|---|
| public void accept(double t) Overrides default java. Implements java. Doc from java. Accepts a double value.
| |
| inputShape | back to summary |
|---|---|
| public StreamShape inputShape() Overrides default java. Doc from java. Gets the shape of the input type of this operation.
| |
IntStream
| Modifier and Type | Field and Description |
|---|---|
| pack-priv final IntConsumer |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public void | accept(int t)
Overrides default java. Implements java. Accepts an int value. |
| public StreamShape | inputShape()
Overrides default java. Gets the shape of the input type of this operation. |
| consumer | back to summary |
|---|---|
| pack-priv final IntConsumer consumer | |
| OfInt | back to summary |
|---|---|
| pack-priv OfInt(IntConsumer consumer, boolean ordered) | |
| accept | back to summary |
|---|---|
| public void accept(int t) Overrides default java. Implements java. Doc from java. Accepts an int value.
| |
| inputShape | back to summary |
|---|---|
| public StreamShape inputShape() Overrides default java. Doc from java. Gets the shape of the input type of this operation.
| |
LongStream
| Modifier and Type | Field and Description |
|---|---|
| pack-priv final LongConsumer |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public void | accept(long t)
Overrides default java. Implements java. Accepts a long value. |
| public StreamShape | inputShape()
Overrides default java. Gets the shape of the input type of this operation. |
| consumer | back to summary |
|---|---|
| pack-priv final LongConsumer consumer | |
| OfLong | back to summary |
|---|---|
| pack-priv OfLong(LongConsumer consumer, boolean ordered) | |
| accept | back to summary |
|---|---|
| public void accept(long t) Overrides default java. Implements java. Doc from java. Accepts a long value.
| |
| inputShape | back to summary |
|---|---|
| public StreamShape inputShape() Overrides default java. Doc from java. Gets the shape of the input type of this operation.
| |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public void | accept(T t)
Implements java. Performs this operation on the given argument. |
| consumer | back to summary |
|---|---|
| pack-priv final Consumer<? super T> consumer | |
| OfRef | back to summary |
|---|---|
| pack-priv OfRef(Consumer<? super T> consumer, boolean ordered) | |
| accept | back to summary |
|---|---|
| public void accept(T t) Implements java. Doc from java. Performs this operation on the given argument.
| |
ForkJoinTask for performing a parallel for-each operation
which visits the elements in encounter order
| Modifier and Type | Field and Description |
|---|---|
| private final Sink | |
| private final PipelineHelper | |
| private final ForEachOps. | |
| private ForEachOps. | |
| private static final VarHandle | |
| private Node | |
| private Spliterator | |
| private final long |
| Access | Constructor and Description |
|---|---|
| protected | |
| pack-priv | ForEachOrderedTask(ForEachOps.
|
| Modifier and Type | Method and Description |
|---|---|
| public final void | compute()
Implements abstract java. The main computation performed by this task. |
| private static <S, T> void | |
| public void | onCompletion(CountedCompleter<?> caller)
Overrides java. Performs an action when method |
| action | back to summary |
|---|---|
| private final Sink<T> action | |
| helper | back to summary |
|---|---|
| private final PipelineHelper<T> helper | |
| leftPredecessor | back to summary |
|---|---|
| private final ForEachOps. | |
| next | back to summary |
|---|---|
| private ForEachOps. | |
| NEXT | back to summary |
|---|---|
| private static final VarHandle NEXT | |
| node | back to summary |
|---|---|
| private Node<T> node | |
| spliterator | back to summary |
|---|---|
| private Spliterator<S> spliterator | |
| targetSize | back to summary |
|---|---|
| private final long targetSize | |
| ForEachOrderedTask | back to summary |
|---|---|
| protected ForEachOrderedTask(PipelineHelper<T> helper, Spliterator<S> spliterator, Sink<T> action) | |
| ForEachOrderedTask | back to summary |
|---|---|
| pack-priv ForEachOrderedTask(ForEachOps. | |
| compute | back to summary |
|---|---|
| public final void compute() Implements abstract java. Doc from java. The main computation performed by this task.
| |
| doCompute | back to summary |
|---|---|
| private static <S, T> void doCompute(ForEachOps. | |
| onCompletion | back to summary |
|---|---|
| public void onCompletion(CountedCompleter<?> caller) Overrides java. Doc from java. Performs an action when method
| |
ForkJoinTask for performing a parallel for-each operation
| Modifier and Type | Field and Description |
|---|---|
| private final PipelineHelper | |
| private final Sink | |
| private Spliterator | |
| private long |
| Access | Constructor and Description |
|---|---|
| pack-priv | |
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public void | compute()
Implements abstract java. The main computation performed by this task. |
| helper | back to summary |
|---|---|
| private final PipelineHelper<T> helper | |
| sink | back to summary |
|---|---|
| private final Sink<S> sink | |
| spliterator | back to summary |
|---|---|
| private Spliterator<S> spliterator | |
| targetSize | back to summary |
|---|---|
| private long targetSize | |
| ForEachTask | back to summary |
|---|---|
| pack-priv ForEachTask(PipelineHelper<T> helper, Spliterator<S> spliterator, Sink<S> sink) | |
| ForEachTask | back to summary |
|---|---|
| pack-priv ForEachTask(ForEachOps. | |
| compute | back to summary |
|---|---|
| public void compute() Implements abstract java. Doc from java. The main computation performed by this task. | |