marking2/danube_test6.scala
changeset 284 9a04eb6a2291
parent 259 43995ea34fe7
equal deleted inserted replaced
283:ef5f62bf5987 284:9a04eb6a2291
       
     1 
       
     2 import CW7b._
     1 
     3 
     2 // first test 
     4 // first test 
     3 
     5 
     4 
     6 
     5 def urban_groupById(ratings: List[(String, String)]) = 
     7 def urban_groupById(ratings: List[(String, String)]) = 
     6   ratings.groupBy(_._1).mapValues(_.map(_._2)) 
     8   ratings.groupBy(_._1).view.mapValues(_.map(_._2)).toMap 
     7 
     9 
     8 def urban_get_csv_file(name: String) : List[String] = {
    10 def urban_get_csv_file(name: String) : List[String] = {
     9   import io.Source
    11   import io.Source
    10   import scala.util._
    12   import scala.util._
    11   val csv = Source.fromFile(name)
    13   val csv = Source.fromFile(name)