This type of source signals completion immediately upon subscription.
Observable<String> empty = Observable.empty(); empty.subscribe(new DefaultObserver<String>() { @Override public void onNext(String s) { System.out.println("This should never be printed!"); } @Override public void onError(Throwable e) { System.out.println("Or this!"); } @Override public void onComplete() { System.out.println("Done will be printed."); } });
References
https://github.com/ReactiveX/RxJava/wiki/Creating-Observables#empty