summaryrefslogtreecommitdiffstats
path: root/Scala
diff options
context:
space:
mode:
Diffstat (limited to 'Scala')
-rw-r--r--Scala/objsets/src/main/scala/objsets/TweetSet.scala8
1 files changed, 5 insertions, 3 deletions
diff --git a/Scala/objsets/src/main/scala/objsets/TweetSet.scala b/Scala/objsets/src/main/scala/objsets/TweetSet.scala
index f558e48..9e350be 100644
--- a/Scala/objsets/src/main/scala/objsets/TweetSet.scala
+++ b/Scala/objsets/src/main/scala/objsets/TweetSet.scala
@@ -211,14 +211,16 @@ object GoogleVsApple {
val google = List("android", "Android", "galaxy", "Galaxy", "nexus", "Nexus")
val apple = List("ios", "iOS", "iphone", "iPhone", "ipad", "iPad")
- lazy val googleTweets: TweetSet = ???
- lazy val appleTweets: TweetSet = ???
+ lazy val googleTweets: TweetSet =
+ TweetReader.allTweets.filter(tweet => (google.foldLeft(false)( _ || tweet.text.contains(_) )) )
+ lazy val appleTweets: TweetSet =
+ TweetReader.allTweets.filter(tweet => (apple.foldLeft(false)( _ || tweet.text.contains(_) )) )
/**
* A list of all tweets mentioning a keyword from either apple or google,
* sorted by the number of retweets.
*/
- lazy val trending: TweetList = ???
+ lazy val trending: TweetList = (googleTweets union appleTweets).descendingByRetweet
}
object Main extends App {