eddard.stark eddard.stark - 2 years ago 113
Java Question

How to use Array[String] in a function expecting String* in Scala

I have a function in Scala that requires a String vararg, i.e.

String*
. How can I call that function if I have an
Array[String]
?

Answer Source

You can use : _* for that

def f(strings: String*) {
  ...
}

f(Array("a", "b", "c"): _*)
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download