I believe that the operators you are looking for are concat or merge .
concat will emit emissions from two or more Observable without alternating them.
merge , on the other hand, will combine several observables by combining their outliers.
For instance:
String[] numbers = {"1", "2", "3", "4"}; String[] letters = {"a", "b", "c", "d"}; Observable<String> query1 = Observable.from(numbers).delay(1, TimeUnit.SECONDS); Observable<String> query2 = Observable.from(letters); Observable .concat(query1, query2) .subscribe(s -> { System.out.printf("-%s-" + s); });
-1--2--3--4--a--b--c--d- will be printed. If you replace concat with merge , the result will be -a--b--c--d--1--2--3--4- .
Operator
Zip combines several Observable together using the specified function. for instance
Observable .zip(query1, query2, (String n, String l) -> String.format("(%s, %s)", n, l)) .subscribe(s -> { System.out.printf("-%s-", s); });
Output -(1, a)--(2, b)--(3, c)--(4, d)- .
source share