T
- The type of the elements that this stream emits.public interface TransformingOperators<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 |
---|---|
<S> TransformingOperators<S> |
flatMap(Function<? super T,? extends PublisherBuilder<? extends S>> mapper)
Map the elements to publishers, and flatten so that the elements emitted by publishers produced by the
mapper function are emitted from this stream. |
<S> TransformingOperators<S> |
flatMapCompletionStage(Function<? super T,? extends CompletionStage<? extends S>> mapper)
Map the elements to
CompletionStage , and flatten so that the elements the values redeemed by each
CompletionStage are emitted from this stream. |
<S> TransformingOperators<S> |
flatMapIterable(Function<? super T,? extends Iterable<? extends S>> mapper)
Map the elements to
Iterable 's, and flatten so that the elements contained in each iterable are
emitted by this stream. |
<S> TransformingOperators<S> |
flatMapRsPublisher(Function<? super T,? extends org.reactivestreams.Publisher<? extends S>> mapper)
Map the elements to publishers, and flatten so that the elements emitted by publishers produced by the
mapper function are emitted from this stream. |
<R> TransformingOperators<R> |
map(Function<? super T,? extends R> mapper)
Map the elements emitted by this stream using the
mapper function. |
<R> TransformingOperators<R> map(Function<? super T,? extends R> mapper)
mapper
function.
R
- The type of elements that the mapper
function emits.mapper
- The function to use to map the elements.<S> TransformingOperators<S> flatMap(Function<? super T,? extends PublisherBuilder<? extends S>> mapper)
mapper
function are emitted from this stream.
This method operates on one publisher at a time. The result is a concatenation of elements emitted from all the publishers produced by the mapper function.
Unlike flatMapRsPublisher(Function)
}, the mapper function returns a
org.eclipse.microprofile.reactive.streams
type instead of an
org.reactivestreams
type.
S
- The type of the elements emitted from the new stream.mapper
- The mapper function.<S> TransformingOperators<S> flatMapRsPublisher(Function<? super T,? extends org.reactivestreams.Publisher<? extends S>> mapper)
mapper
function are emitted from this stream.
This method operates on one publisher at a time. The result is a concatenation of elements emitted from all the publishers produced by the mapper function.
Unlike flatMap(Function)
, the mapper function returns a org.eclipse.microprofile.reactive.streams
builder instead of an org.reactivestreams
type.
S
- The type of the elements emitted from the new stream.mapper
- The mapper function.<S> TransformingOperators<S> flatMapCompletionStage(Function<? super T,? extends CompletionStage<? extends S>> mapper)
CompletionStage
, and flatten so that the elements the values redeemed by each
CompletionStage
are emitted from this stream.
This method only works with one element at a time. When an element is received, the mapper
function is
executed, and the next element is not consumed or passed to the mapper
function until the previous
CompletionStage
is redeemed. Hence this method also guarantees that ordering of the stream is maintained.
S
- The type of the elements emitted from the new stream.mapper
- The mapper function.<S> TransformingOperators<S> flatMapIterable(Function<? super T,? extends Iterable<? extends S>> mapper)
Iterable
's, and flatten so that the elements contained in each iterable are
emitted by this stream.
This method operates on one iterable at a time. The result is a concatenation of elements contain in all the
iterables returned by the mapper
function.
S
- The type of the elements emitted from the new stream.mapper
- The mapper function.Copyright © 2019 Eclipse Foundation. All rights reserved.