Open ThijsBroersen opened 5 years ago
Some methods like toStreamWithHeaders are not intended to be called twice since it holds iterator to read lines.
scala> CSVReader.open("a.csv")
res6: com.github.tototoshi.csv.CSVReader = com.github.tototoshi.csv.CSVReader@19dd3ae0
scala> res6.toStream.toList
res7: List[List[String]] = List(List(NAME, VALUE), List(a, 1), List(b, 2), List(c, 3))
scala> res6.toStream.toList
res8: List[List[String]] = List()
When you need to read a file twice, please open the file again with CSVReader#open
When calling toStreamWithHeaders.head two times it takes the headers correctly on the first call, the second call it used the next line as header-line.