June 2017
Intermediate to advanced
400 pages
8h 44m
English
When you call the subscribe() method on an Observable, an Observer is used to consume these three events by implementing its methods. Instead of specifying lambda arguments like we were doing earlier, we can implement an Observer and pass an instance of it to the subscribe() method. Do not bother yourself about onSubscribe() at the moment. Just leave its implementation empty until we discuss it at the end of this chapter:
import io.reactivex.Observable; import io.reactivex.Observer; import io.reactivex.disposables.Disposable; public class Launcher { public static void main(String[] args) { Observable<String> source = Observable.just("Alpha", "Beta", "Gamma", "Delta", "Epsilon"); Observer<Integer ...
Read now
Unlock full access