Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
exists in scala
object TweetUtil {
def main(args: Array[String]) {
val keywords = List("brown", "fox", "dog", "pangram")
val tweet = "The quick brown fox jumps over a lazy dog. #pangram http://www.rinkworks.com/words/pangrams.shtml"
keywords.exists(tweet.contains)
(keywords.foldLeft(false)( _ || tweet.contains(_) ))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment