Created
March 6, 2018 15:03
-
-
Save rnaufal/37d27a8901cae1264ca89a250b31109f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Collection<Car> markCars = people | |
.stream() | |
.filter(person -> "Mark".equals(person.getName())) | |
.findFirst() | |
.map(Person::getCars) | |
.filter(Optional::isPresent) | |
.map(Optional::get) | |
.orElse(Collections.emptyList()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment