T
- The type of the elements that the stream emits.public interface PeekingOperators<T>
The documentation for each operator uses marble diagrams to visualize how the operator functions. Each element flowing in and out of the stream is represented as a coloured marble that has a value, with the operator applying some transformation or some side effect, termination and error signals potentially being passed, and for operators that subscribe to the stream, an output value being redeemed at the end.
Below is an example diagram labelling all the parts of the stream.
Modifier and Type | Method and Description |
---|---|
PeekingOperators<T> |
onComplete(Runnable action)
Returns a stream containing all the elements from this stream, additionally performing the provided action when
this stream completes.
|
PeekingOperators<T> |
onError(Consumer<Throwable> errorHandler)
Returns a stream containing all the elements from this stream, additionally performing the provided action if
this stream conveys an error.
|
PeekingOperators<T> |
onTerminate(Runnable action)
Returns a stream containing all the elements from this stream, additionally performing the provided action when
this stream completes or failed.
|
PeekingOperators<T> |
peek(Consumer<? super T> consumer)
Returns a stream containing all the elements from this stream, additionally performing the provided action on
each element.
|
PeekingOperators<T> peek(Consumer<? super T> consumer)
consumer
- The function called for every element.T
and emits the same elements. In
between, the given function is called for each element.PeekingOperators<T> onError(Consumer<Throwable> errorHandler)
errorHandler
- The function called with the failure.T
and emits the same elements. If the
stream conveys a failure, the given error handler is called.PeekingOperators<T> onTerminate(Runnable action)
onError(Consumer)
and onComplete(Runnable)
. In addition, the action is called
if the stream is cancelled downstream.
action
- The function called when the stream completes or failed.T
and emits the same elements. The given
action is called when the stream completes or fails.PeekingOperators<T> onComplete(Runnable action)
action
- The function called when the stream completes.T
and emits the same elements. The given
action is called when the stream completes.Copyright © 2018 – 2022 Eclipse Foundation. All rights reserved.
Use is subject to license terms.