I have a list of Observables (RxJava 1).
List observableList = new ArrayList<>();
It can contain at least 1 Observable.
You can use the static zip(java.lang.Iterable extends Observable>> ws,FuncN extends R> zipFunction) method.
It is a zip
method that takes an Iterable
of Observable
s and a FuncN (which takes a varargs parameter for its call
method) and uses it to combine the corresponding emitted Object
s into the result to be omitted by the new returned Observable
.
So for example you could do:
Observable.zip(observableList, new FuncN(){
public ReturnType call(java.lang.Object... args){
ReturnType result; //to be made
//preparatory code for using the args
for (Object obj : args){
ReturnType retObj = (ReturnType)obj;
//code to use the arg once at a time to combine N of them into one.
}
return result;
}
});