Class ScalarXMapZHelper
java.lang.Object
io.reactivex.rxjava3.internal.operators.mixed.ScalarXMapZHelper
Utility class to extract a value from a scalar source reactive type,
map it to a 0-1 type then subscribe the output type's consumer to it,
saving on the overhead of the regular subscription channel.
History: 2.1.11 - experimental
- Since:
- 2.2
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) static <T> boolean
tryAsCompletable
(Object source, Function<? super T, ? extends CompletableSource> mapper, CompletableObserver observer) Try subscribing to aCompletableSource
mapped from a scalar source (which implementsSupplier
).(package private) static <T,
R> boolean tryAsMaybe
(Object source, Function<? super T, ? extends MaybeSource<? extends R>> mapper, Observer<? super R> observer) Try subscribing to aMaybeSource
mapped from a scalar source (which implementsSupplier
).(package private) static <T,
R> boolean tryAsSingle
(Object source, Function<? super T, ? extends SingleSource<? extends R>> mapper, Observer<? super R> observer) Try subscribing to aSingleSource
mapped from a scalar source (which implementsSupplier
).
-
Constructor Details
-
ScalarXMapZHelper
private ScalarXMapZHelper()
-
-
Method Details
-
tryAsCompletable
static <T> boolean tryAsCompletable(Object source, Function<? super T, ? extends CompletableSource> mapper, CompletableObserver observer) Try subscribing to aCompletableSource
mapped from a scalar source (which implementsSupplier
).- Type Parameters:
T
- the upstream value type- Parameters:
source
- the source reactive type (Flowable
orObservable
) possibly implementingSupplier
.mapper
- the function that turns the scalar upstream value into aCompletableSource
observer
- the consumer to subscribe to the mappedCompletableSource
- Returns:
- true if a subscription did happen and the regular path should be skipped
-
tryAsMaybe
static <T,R> boolean tryAsMaybe(Object source, Function<? super T, ? extends MaybeSource<? extends R>> mapper, Observer<? super R> observer) Try subscribing to aMaybeSource
mapped from a scalar source (which implementsSupplier
).- Type Parameters:
T
- the upstream value typeR
- the downstream value type- Parameters:
source
- the source reactive type (Flowable
orObservable
) possibly implementingSupplier
.mapper
- the function that turns the scalar upstream value into aMaybeSource
observer
- the consumer to subscribe to the mappedMaybeSource
- Returns:
- true if a subscription did happen and the regular path should be skipped
-
tryAsSingle
static <T,R> boolean tryAsSingle(Object source, Function<? super T, ? extends SingleSource<? extends R>> mapper, Observer<? super R> observer) Try subscribing to aSingleSource
mapped from a scalar source (which implementsSupplier
).- Type Parameters:
T
- the upstream value typeR
- the downstream value type- Parameters:
source
- the source reactive type (Flowable
orObservable
) possibly implementingSupplier
.mapper
- the function that turns the scalar upstream value into aSingleSource
observer
- the consumer to subscribe to the mappedSingleSource
- Returns:
- true if a subscription did happen and the regular path should be skipped
-