I am interfacing with a Java library which takes in a double[] as parameter and add elements to the array. I tried creating a Scala mutable array with JavaConversions but it is not able to manage this conversion. Any ideas?
Java:
public static double libraryFn(double[] numbers) {
.....
numbers[0] = 1.0
}
Scala:
def caller() {
// Does not work
val myNumbers = new Array[java.lang.Double](1)
libraryFn(myNumbers)
}
Thanks for the responses. Looking at the library source more closely, it looks like the library has a bug and was not a scala/java issue at all.
java.lang.Doubleis not Java'sdouble. It needs to beArray[Double], in Scala.