Last active
October 11, 2015 10:48
-
-
Save aruld/3847359 to your computer and use it in GitHub Desktop.
exists in Java 8
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
// take 1 | |
keywords.stream().anyMatch(keyword -> tweet.contains(keyword)); | |
// take 2 using method reference | |
keywords.stream().anyMatch(tweet::contains) | |
// take 3 using reduce() | |
keywords.stream().reduce(false, (Boolean b, String keyword) -> b || tweet.contains(keyword), (l, r) -> l | r); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment