Skip to content

Instantly share code, notes, and snippets.

@logcat
Created June 24, 2015 12:52
Show Gist options
  • Save logcat/008d54a9557595e5c5e3 to your computer and use it in GitHub Desktop.
Save logcat/008d54a9557595e5c5e3 to your computer and use it in GitHub Desktop.
public class Transformers {
public static <T> Observable.Transformer<Iterable<T>, T> flatten() {
return new Observable.Transformer<Iterable<T>, T>() {
@Override
public Observable<T> call(Observable<Iterable<T>> iterableObservable) {
return iterableObservable.flatMap(new Func1<Iterable<T>, Observable<T>>() {
@Override
public Observable<T> call(Iterable<T> iterable) {
return Observable.from(iterable);
}
});
}
};
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment