Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save givemepassxd999/79b102e726485dc131382cbefa041ad7 to your computer and use it in GitHub Desktop.
Save givemepassxd999/79b102e726485dc131382cbefa041ad7 to your computer and use it in GitHub Desktop.
Observable.fromIterable(getAlbum())
.flatMap(new Function<Album, ObservableSource<Song>>() {
@Override
public ObservableSource<Song> apply(Album album) throws Exception {
return Observable.fromIterable(album.getSongs());
}
})
.filter(new Predicate<Song>() {
@Override
public boolean test(@NonNull Song song) throws Exception {
return false;
}
})
.subscribeOn(Schedulers.newThread())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Consumer<Song>() {
@Override
public void accept(Song song) throws Exception {
System.out.println(song.getSongName());
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment