Skip to content

Instantly share code, notes, and snippets.

@beall49
Created July 24, 2019 23:44
Show Gist options
  • Save beall49/aeb7d7fbb6707ead8a449c445d473d3a to your computer and use it in GitHub Desktop.
Save beall49/aeb7d7fbb6707ead8a449c445d473d3a to your computer and use it in GitHub Desktop.
A list of items that gets a list into a single list :)
/**
* Take a list of items, iterate, and get some list of items then flatten that list of items into a single list.
*/
List<String> indexed = listOfStrings.stream()
.map(li -> li.getSomeListOfItems())
.flatMap(List::stream)
.collect(toList());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment