Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
exists implementation in plain old java
public class TweetUtil {
public static void main(String[] args) {
final List<String> keywords = Arrays.asList("brown", "fox", "dog", "pangram");
final String tweet = "The quick brown fox jumps over a lazy dog. #pangram http://www.rinkworks.com/words/pangrams.shtml";
exists(keywords, tweet);
}
public static boolean exists(List<String> keywords, String tweet) {
for (String keyword : keywords) {
if (tweet.contains(keyword)) return true;
}
return false;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment