Skip to content

Instantly share code, notes, and snippets.

@aruld
Last active October 11, 2015 10:48
Show Gist options
  • Save aruld/3847359 to your computer and use it in GitHub Desktop.
Save aruld/3847359 to your computer and use it in GitHub Desktop.
exists in Java 8
// 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