February 2020
Intermediate to advanced
412 pages
9h 36m
English
When you create your own ObservableOperator, you will most likely want to create a FlowableOperator counterpart as well. This way, your operator can be used for both Observable and Flowable.
Thankfully, FlowableOperator is implemented in a manner similar to how ObservableOperator is implemented, as shown here:
private static <T> FlowableOperator<T, T> doOnEmpty(Action action) { return new FlowableOperator<T, T>() { @Override public Subscriber<? super T> apply(Subscriber<? super T> subscriber) throws Exception { return new DisposableSubscriber<T>() { boolean isEmpty = true; @Override public void onNext(T value) { isEmpty = false; subscriber.onNext(value); } @Override public void onError(Throwable t) { subscriber ...
Read now
Unlock full access