I have problem with JavaConversions with 2.8 beta:
import scala.collection.JavaConversions._
class Utils(dbFile : File, sep: String) extends IUtils {
(...)
def getFeatures() : java.util.List[String] = csv.attributes.toList
}
And then exception:
[INFO] Utils.scala:20: error: type mismatch;
[INFO] found : List[String]
[INFO] required: java.util.List[String]
[INFO] def getFeatures() : java.util.List[String] = csv.attributes.toList
[INFO]
JavaConversions does not support the conversion between a scala List (immutable, recursive data structure) and a java List (a mutable sequence). The analog in scala is a buffer:
From the scaladoc
The following conversions are supported:
scala.collection.mutable.Buffer <=> java.util.List
You might want to change your code to:
def getFeatures() : java.util.List[String]
= new ListBuffer[String] ++ csv.attributes.toList
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With