main_solution1/drumb.scala
changeset 384 6e1237691307
parent 348 b5b6ed38c2f2
child 396 3ffe978a5664
equal deleted inserted replaced
383:c02929f2647c 384:6e1237691307
    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))