Created
December 17, 2017 15:12
-
-
Save Jayasagar/a71cd03595629b84c15e7107932fd98c 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
// User Bob devices sort by name | |
List<Thing> bobDevicesSortByName = bob.getThings() | |
.stream() | |
// sorted is an intermediate operation | |
.sorted(Comparator.comparing(Thing::getName)) | |
.collect(Collectors.toList()); | |
System.out.println(bobDevicesSortByName); | |
// Output: [Thing(name=AgriFieldSensor), Thing(name=Bulb), Thing(name=EyeVirusDetector), Thing(name=MotionDetector)] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment