February 2020
Intermediate to advanced
412 pages
9h 36m
English
More likely, you will use a Subject to eagerly subscribe to an unknown number of multiple source observables and consolidate their emissions in a single Observable object. Since a Subject is an Observer too, you can pass it to a subscribe() method. This can be helpful in the modularized code where decoupling between observables and observers takes place and executing Observable.merge() is not that easy. Here, for example, we use Subject to merge and multicast two Observable interval sources as follows:
import io.reactivex.rxjava3.core.Observable;import io.reactivex.rxjava3.subjects.PublishSubject;import io.reactivex.rxjava3.subjects.Subject;import java.util.concurrent.TimeUnit;public class Ch5_16 { public static void ...
Read now
Unlock full access