-
Notifications
You must be signed in to change notification settings - Fork 50
Description
I'm following the example on https://github.com/jsuereth/scala-arm/wiki/Basic-Usage , but with a jcsv com.googlecode.jcsv.reader.CSVReader ( from http://jcsv.googlecode.com/svn/trunk/apidocs/index.html ) . It didn't work as advertised with CSVReader and it took my writing this bug report to figure out why.
With
for(row:CSVTableRow <- managed(CSVReaderCreator.createCSVReaderForRows(columnMap,csvFile,'\t'))) { ... }
I get
[error] /Users/dwalend/projects/an/ONADemoScalaCSV/ScalaCSV/src/main/scala/activatenetworks/ona/LoadNodes.scala:82: value filter is not a member of resource.ManagedResource[com.googlecode.jcsv.reader.CSVReader[activatenetworks.tools.csvtable.CSVReaderCreator.CSVTableRow]]
CSVReader does implement Closable. It also implements Iterable, which is what I really want to think about.
for(csvReader <- managed(CSVReaderCreator.createCSVReaderForRows(columnMap,csvFile,'\t'))) {
for(row:CSVTableRow <- csvReader) { ... }}
compiles fine.
for(csvReader <- managed(CSVReaderCreator.createCSVReaderForRows(columnMap,csvFile,'\t'));
for(row:CSVTableRow <- csvReader) { ... }}
doesn't work either.
An example with Iterable would have saved me (and maybe others) some time.
Also, is for() the right name to use? It can't do everything that for() does with Iterable. Would with() be better? (Or did that ship already sail?)
Thanks,
Dave