February 2020
Intermediate to advanced
412 pages
9h 36m
English
The Observable.merge() factory will take two or more Observable<T> sources emitting the same type T and then consolidate them into a single Observable<T>.
If we have only two to four Observable<T> sources to merge, you can pass each one as an argument to the Observable.merge() factory. In the following code snippet, I have merged two Observable<String> instances into one Observable<String>:
import io.reactivex.rxjava3.core.Observable;public class Ch4_01 { public static void main(String[] args) { Observable<String> src1 = Observable.just("Alpha", "Beta"); Observable<String> src2 = Observable.just("Zeta", "Eta"); Observable.merge(src1, src2) .subscribe(i -> System.out.println("RECEIVED: " ...
Read now
Unlock full access