Created
July 30, 2018 06:34
-
-
Save jiahut/21362dce131839f21a1403c34b333fc9 to your computer and use it in GitHub Desktop.
Difference between findAny() and findFirst() in Java 8
This file contains hidden or 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
| def l = Arrays.asList("B","A","C") | |
| def r = l.stream().parallel().filter { e -> e != "B" } .findAny() | |
| def s = l.stream().parallel().filter { it != "B"}.findFirst() | |
| println l | |
| println r.get() | |
| println s.get() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment