Scala: Read file from IO and line by line match it construct a case class and add the case class to a List?

Replace foreach with map and you'll get an IteratorNameDatum . Add a toList after getLines() to get a ListNameDatum instead, though it's probably better to use toStream and work with a StreamNameDatum instead, if you expect the file to be too big to fit all in memory.

I think the problem is that you're using foreach, which has a return-type of unit; see the signature of foreach from the following: http://www.scala-lang.org/api/current/index.html#scala.collection.Iterator.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions