Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@WonderCsabo
Created November 6, 2015 09:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save WonderCsabo/132c1340aac48a70a436 to your computer and use it in GitHub Desktop.
Save WonderCsabo/132c1340aac48a70a436 to your computer and use it in GitHub Desktop.
Observable.from(parents)
.flatMap(Observable::from)
.map(parent -> parent.children)
.flatMap(Observable::from)
.filter(c -> c.index % 2 == 0)
.groupBy(child -> child.parent)
.flatMap(Observable::toList)
.map(children -> {
Listing child = children.get(0); // i know there is at least one
child.parent.children = children;
return child.parent;
})
.subscribe(...)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment