solutions2/danube.scala
changeset 284 9a04eb6a2291
parent 209 40bdf9064e13
child 325 ca9c1cf929fa
--- a/solutions2/danube.scala	Tue Oct 29 23:56:13 2019 +0000
+++ b/solutions2/danube.scala	Wed Oct 30 11:28:44 2019 +0000
@@ -1,6 +1,6 @@
-// Part 2 and 3 about Movie Recommendations 
+// Core Part about Movie Recommendations 
 // at Danube.co.uk
-//===========================================
+//========================================
 
 import io.Source
 import scala.util._
@@ -117,7 +117,7 @@
 def suggestions(recs: Map[String, List[String]], 
                     mov_name: String) : List[String] = {
   val favs = favourites(recs, mov_name).flatten
-  val favs_counted = favs.groupBy(identity).mapValues(_.size).toList
+  val favs_counted = favs.groupBy(identity).view.mapValues(_.size).toList
   val favs_sorted = favs_counted.sortBy(_._2).reverse
   favs_sorted.map(_._1)
 }