Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fastest way to convert Scala array to Java array

Tags:

scala

I have a method in Java with this signature void setActiveProfiles(String... profiles), and in Java I can pass an array of string to this method. I want to call the method and pass it an Array[String], but I got Type mismatch error. And my question is what is the best and optimal way to convert Scala array to Java array?

This is the body of compilation error:

type mismatch;
 found   : Array[String]
 required: String
like image 590
Pooya Avatar asked Oct 03 '22 09:10

Pooya


1 Answers

I've found the answer and I've tested it, call method as setActiveProfiles(array:_*)

like image 165
Pooya Avatar answered Oct 07 '22 19:10

Pooya