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();
Single.toObservable()
will check for this interface and call thefuseToObservable()
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
All Methods Instance Methods Abstract Methods Modifier and Type Method Description @NonNull Observable<T>
fuseToObservable()
Returns a (direct) Observable for the operator.
-
-
-
Method Detail
-
fuseToObservable
@NonNull @NonNull Observable<T> fuseToObservable()
Returns a (direct) Observable for the operator.The implementation should handle the necessary RxJavaPlugins wrapping.
- Returns:
- the Observable instance
-
-