I have a class defined in java
public class A {
List<Group> javaMethod() {
}
}
and a class in Scala
public class S extends A {
override javaMethod: List[Group] {
}
}
However, I get an error saying method javaMethod has incompatible type
, I'm assuming because of the List that gets returned in the method when it gets overwritten, is of type scala.immutable.List, and the one that is required for the javaMethod is java.util.List.
I don't have access to class A, so I can't change the signature of the function. How can I return a scala List where I'm overriding the method, without getting a type error?
EDIT: This will get my list from Java to Scala, but I'm wanting to convert the Java list to the Scala list.
import scala.collection.JavaConversions._
import scala.collection.mutable.ListBuffer
asList(ListBuffer(List(1,2,3): _*))
val x: java.util.List[Int] = ListBuffer(List(1,2,3): _*)