The title asks the question. Basically I am using a java library that takes a String… as a parameter. How can I call that in my scala code?
I’ll add a bit more:
from scala code
def myScalaFunc(params:String*) {
val myJavaClass = new JavaClass()
myJavaClass(params)
}
You have to expand the
paramsinto a series of arguments, not just a single collection argument. The easiest way to do this is by sayingparams: _*.If the Java looks like:
Then the Scala caller looks like: