The onNext(), onComplete(), and onError() methods actually compose the Observer type – an interface implemented throughout RxJava to communicate the corresponding events. The following is the Observer interface definition (do not concern yourself with onSubscribe() for now, as we will cover it at the end of this chapter):
import io.reactivex.rxjava3.disposables.Disposable;
public interface Observer<T> {
void onSubscribe@NonNull Disposable d);
void onNext(@NonNull T value);
void onError(Throwable e);
void onComplete();
}
An Observer and source Observable are somewhat related. In one context, a source Observable is where emissions originate and the processing chain starts. In our previous examples, you could say that the Observable was returned by the Observable.create() or Observable.just() methods. But to the filter() operator...