I\'m calling a Scala method, from Java. And I need to make the conversion from Seq to List.
I can\'t modified the signature of the Scala method, so I can\'t used the
You're on the right track using JavaConversions
, but the method you need for this particular conversion is seqAsJavaList
:
java.util.List convert(scala.collection.Seq seq) {
return scala.collection.JavaConversions.seqAsJavaList(seq);
}
Update: JavaConversions
is deprecated, but the same function can be found in JavaConverters.
java.util.List convert(scala.collection.Seq seq) {
return scala.collection.JavaConverters.seqAsJavaList(seq);
}