Created
December 17, 2017 15:10
-
-
Save Jayasagar/4c35d397ff1b983194073bf179a8e4ee 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
List<Consumer> consumersByAge = | |
consumerList | |
.stream() | |
// filter is an intermediate operation | |
.filter(consumer -> consumer.getAge() > 30) | |
// collect is a terminal operation | |
.collect(Collectors.toList()); | |
System.out.println(consumersByAge); | |
// Output: [Consumer(name=Sri, city=Hyd), Consumer(name=Bob, city=Berlin)] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment