public final class MaybeInterop
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static <T> io.reactivex.functions.Function<io.reactivex.Maybe<T>,java.util.Optional<T>> |
element()
Block until the source Maybe completes and return its possible value as Optional.
|
static <T> io.reactivex.Maybe<T> |
fromFuture(java.util.concurrent.CompletionStage<T> cs)
Returns a Maybe that emits the resulting value of the CompletionStage or
its error, treating null as empty source.
|
static <T> io.reactivex.Maybe<T> |
fromOptional(java.util.Optional<T> opt)
Returns a Maybe that emits the value of the Optional or is
empty if the Optional is also empty.
|
static <T> io.reactivex.functions.Function<io.reactivex.Maybe<T>,java.util.concurrent.CompletionStage<T>> |
get()
Returns a CompletionStage that signals the single value or terminal event
of the given Maybe source.
|
static <T,R> io.reactivex.MaybeTransformer<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.Maybe<T>,java.util.stream.Stream<T>> |
toStream()
Returns a blocking Stream of a potentially zero or one value (or error) of
the Maybe.
|
public static <T> io.reactivex.Maybe<T> fromOptional(java.util.Optional<T> opt)
T - the value typeopt - the Optional valuepublic static <T> io.reactivex.Maybe<T> fromFuture(java.util.concurrent.CompletionStage<T> cs)
T - the value typecs - the source CompletionStage instancepublic static <T> io.reactivex.functions.Function<io.reactivex.Maybe<T>,java.util.concurrent.CompletionStage<T>> get()
An empty Maybe will complete with a null value
T - the value typeMaybe.to()public static <T> io.reactivex.functions.Function<io.reactivex.Maybe<T>,java.util.stream.Stream<T>> toStream()
T - the value typeMaybe.to()public static <T> io.reactivex.functions.Function<io.reactivex.Maybe<T>,java.util.Optional<T>> element()
T - the value typeMaybe.to().public static <T,R> io.reactivex.MaybeTransformer<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()