Interface FuseToObservable<T>
- Type Parameters:
T
- the value type
- All Known Implementing Classes:
ObservableAllSingle
,ObservableAnySingle
,ObservableCollectSingle
,ObservableCollectWithCollectorSingle
,ObservableCountSingle
,ObservableElementAtMaybe
,ObservableElementAtSingle
,ObservableFlatMapCompletableCompletable
,ObservableIgnoreElementsCompletable
,ObservableSequenceEqualSingle
,ObservableToListSingle
public interface FuseToObservable<@NonNull T>
Interface indicating a operator implementation can be macro-fused back to Observable in case
the operator goes from Observable to some other reactive type and then the sequence calls
for toObservable again:
Single<Integer> single = Observable.range(1, 10).reduce((a, b) -> a + b);
Observable<Integer> observable = single.toObservable();
The Single.toObservable()
will check for this interface and call the fuseToObservable()
to return an Observable which could be the Observable-specific implementation of reduce(BiFunction).
This causes a slight overhead in assembly time (1 instanceof check, 1 operator allocation and 1 dropped operator) but does not incur the conversion overhead at runtime.
-
Method Summary
Modifier and TypeMethodDescriptionReturns a (direct) Observable for the operator.
-
Method Details
-
fuseToObservable
Returns a (direct) Observable for the operator.The implementation should handle the necessary RxJavaPlugins wrapping.
- Returns:
- the Observable instance
-