Skip to content

Instantly share code, notes, and snippets.

@eeichinger
Created September 24, 2016 11:17
Show Gist options
  • Save eeichinger/1968afe2ca0f3d132be0df2060d1b1c2 to your computer and use it in GitHub Desktop.
Save eeichinger/1968afe2ca0f3d132be0df2060d1b1c2 to your computer and use it in GitHub Desktop.
typed Observable.zipN for input observables of same type
@SuppressWarnings("unchecked")
static <R, T> Observable<R> zip(Iterable<? extends Observable<T>> ws, Func1<List<T>, ? extends R> zipFunction) {
FuncN<R> funcN = (Object[] array) -> {
List<T> l = new ArrayList<T>();
for (Object o : array) {
l.add((T) o);
}
return zipFunction.call(l);
};
return Observable.zip(ws, funcN);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment