If you want to wait for the elements to be emitted from two observables (synchronizing them), you usually want something like Observable.zip :
Observable<String> o1 = Observable.just("a", "b", "c"); Observable<Integer> o2 = Observable.just(1, 2, 3); Observable<String> result = Observable.zip(o1, o2, (a, b) -> a + b);
result will be observable, generating the use of elements (a, b) -> a + b to o1 and o2 . As a result, the observed income is "a1", "b2", "c3" .
You can also use Obervable.zipWith with the actual instance to get the same effect.
Note that this will be completed on a shorter observable if you do nothing zip with.
source share