main_solution1/drumb.scala
changeset 348 b5b6ed38c2f2
parent 347 4de31fdc0d67
child 384 6e1237691307
equal deleted inserted replaced
347:4de31fdc0d67 348:b5b6ed38c2f2
    22 //     It should read the corresponding CSV-file and reads the January 
    22 //     It should read the corresponding CSV-file and reads the January 
    23 //     data from the given year. The data should be collected in a list of
    23 //     data from the given year. The data should be collected in a list of
    24 //     strings for each line in the CSV-file.
    24 //     strings for each line in the CSV-file.
    25 
    25 
    26 def get_january_data(symbol: String, year: Int) : List[String] = 
    26 def get_january_data(symbol: String, year: Int) : List[String] = 
    27   Source.fromFile(symbol ++ ".csv")("ISO-8859-1").getLines.toList.filter(_.startsWith(year.toString))
    27   Source.fromFile(symbol ++ ".csv")("ISO-8859-1").getLines().toList.filter(_.startsWith(year.toString))
    28 
    28 
    29 
    29 
    30 //test cases
    30 //test cases
    31 //blchip_portfolio.map(get_january_data(_, 2018))
    31 //blchip_portfolio.map(get_january_data(_, 2018))
    32 //rstate_portfolio.map(get_january_data(_, 2018))
    32 //rstate_portfolio.map(get_january_data(_, 2018))