public final class FlowableInterop
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static <T,A,R> io.reactivex.FlowableTransformer<T,R> |
collect(java.util.stream.Collector<T,A,R> collector)
Collect the elements of the Flowable via the help of Collector and its callback
functions.
|
static <T> io.reactivex.functions.Function<io.reactivex.Flowable<T>,java.util.concurrent.CompletionStage<T>> |
first()
Returns a CompletionStage that signals the first element of the Flowable
or a NoSuchElementException if the Flowable is empty.
|
static <T> io.reactivex.functions.Function<io.reactivex.Flowable<T>,java.util.Optional<T>> |
firstElement()
Block until the source Flowable emits its first item and return that as Optional.
|
static <T,R> io.reactivex.FlowableTransformer<T,R> |
flatMapStream(io.reactivex.functions.Function<? super T,? extends java.util.stream.Stream<R>> mapper)
Map each value of the upstream into a Stream and flatten them into a single sequence.
|
static <T> io.reactivex.Flowable<T> |
fromFuture(java.util.concurrent.CompletionStage<T> cs)
Create a Flowable that signals the terminal value or error of the given
CompletionStage.
|
static <T> io.reactivex.Flowable<T> |
fromOptional(java.util.Optional<T> opt)
Returns a Flowable for the value (or lack of) in the given Optional.
|
static <T> io.reactivex.Flowable<T> |
fromStream(java.util.stream.Stream<T> stream)
Wrap a Stream into a Flowable.
|
static <T> io.reactivex.functions.Function<io.reactivex.Flowable<T>,java.util.concurrent.CompletionStage<T>> |
last()
Returns a CompletionStage that emits the last element of the Flowable or
NoSuchElementException if the Flowable is empty.
|
static <T> io.reactivex.functions.Function<io.reactivex.Flowable<T>,java.util.Optional<T>> |
lastElement()
Block until the source Flowable completes and return its last value as Optional.
|
static <T,R> io.reactivex.FlowableTransformer<T,R> |
mapOptional(io.reactivex.functions.Function<? super T,java.util.Optional<R>> mapper)
Maps the upstream value into an optional and extracts its optional value to be emitted towards
the downstream if present.
|
static <T> io.reactivex.functions.Function<io.reactivex.Flowable<T>,java.util.concurrent.CompletionStage<T>> |
single()
Returns a CompletionStage that signals the single element of the Flowable,
IllegalArgumentException if the Flowable is longer than 1 element
or a NoSuchElementException if the Flowable is empty.
|
static <T> io.reactivex.functions.Function<io.reactivex.Flowable<T>,java.util.stream.Stream<T>> |
toStream()
Returns a blocking Stream of the elements of the Flowable.
|
public static <T> io.reactivex.Flowable<T> fromStream(java.util.stream.Stream<T> stream)
Note that Streams can only be consumed once and non-concurrently.
T - the value typestream - the source Streampublic static <T> io.reactivex.Flowable<T> fromOptional(java.util.Optional<T> opt)
T - the value typeopt - the optional to wrappublic static <T> io.reactivex.Flowable<T> fromFuture(java.util.concurrent.CompletionStage<T> cs)
Cancelling the Flowable subscription doesn't cancel the CompletionStage.
T - the value typecs - the CompletionStage instancepublic static <T,A,R> io.reactivex.FlowableTransformer<T,R> collect(java.util.stream.Collector<T,A,R> collector)
T - the upstream value typeA - the accumulated typeR - the result typecollector - the Collector object providing the callbacksFlowable.compose()public static <T> io.reactivex.functions.Function<io.reactivex.Flowable<T>,java.util.concurrent.CompletionStage<T>> first()
T - the value typeFlowable.to.public static <T> io.reactivex.functions.Function<io.reactivex.Flowable<T>,java.util.concurrent.CompletionStage<T>> single()
T - the value typeFlowable.to.public static <T> io.reactivex.functions.Function<io.reactivex.Flowable<T>,java.util.concurrent.CompletionStage<T>> last()
T - the value typeFlowable.to.public static <T> io.reactivex.functions.Function<io.reactivex.Flowable<T>,java.util.stream.Stream<T>> toStream()
Closing the Stream will cancel the flow.
T - the value typeFlowable.to.public static <T> io.reactivex.functions.Function<io.reactivex.Flowable<T>,java.util.Optional<T>> firstElement()
T - the value typeFlowable.to().public static <T> io.reactivex.functions.Function<io.reactivex.Flowable<T>,java.util.Optional<T>> lastElement()
T - the value typeFlowable.to().public static <T,R> io.reactivex.FlowableTransformer<T,R> flatMapStream(io.reactivex.functions.Function<? super T,? extends java.util.stream.Stream<R>> mapper)
T - the input value typeR - the Stream typemapper - the function that returns a Stream for each upstream valueFlowable.compose()public static <T,R> io.reactivex.FlowableTransformer<T,R> mapOptional(io.reactivex.functions.Function<? super T,java.util.Optional<R>> mapper)
T - the upstream value typeR - the result value typemapper - the function receiving the upstream value and should return an OptionalFlowable.compose()