Closed
Description
Currently the zip
function takes an Iterable in the form Iterable<? extends Observable<?>> ws
and then is transformed into an array:
List<Observable<?>> os = new ArrayList<Observable<?>>();
for (Observable<?> o : ws) {
os.add(o);
}
return Observable.just(os.toArray(new Observable<?>[os.size()])).lift(new OperatorZip<R>(zipFunction));
This causes not only the copy from one list to another but also a copy from the created list to the array, which will add some overhead if the list is big enough.
Instead, consider adding the following function:
public static <R> Observable<R> zip(Observable<?>[] ws, FuncN<? extends R> zipFunction) {
return Observable.just(ws).lift(new OperatorZip<R>(zipFunction));
}
So whoever who has the chance to create an array instead of a List will save some cpu time.
I'd be glad to create a pull request with the related code to any specified branch if needed.
Thanks for your attention.