Created
September 24, 2016 11:17
-
-
Save eeichinger/1968afe2ca0f3d132be0df2060d1b1c2 to your computer and use it in GitHub Desktop.
typed Observable.zipN for input observables of same type
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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