Skip to content

Instantly share code, notes, and snippets.

@kellegous
Created October 25, 2015 17:38
Show Gist options
  • Select an option

  • Save kellegous/2853ff50260db46e8dc6 to your computer and use it in GitHub Desktop.

Select an option

Save kellegous/2853ff50260db46e8dc6 to your computer and use it in GitHub Desktop.
public Stream<Verse> allVerses() {
return books().stream().reduce(
Stream.empty(),
(sa, b) -> b.chapters().stream().reduce(
sa,
(sb, ch) -> Stream.concat(sb, ch.verses().stream()),
(sb, sc) -> Stream.concat(sb, sc)),
(sb, sc) -> Stream.concat(sb, sc));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment