The fastest way to convert a Scala array to a Java array

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

This is the body of the compilation error:

 type mismatch; found : Array[String] required: String 
+4
source share
1 answer

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

+5
source

Source: https://habr.com/ru/post/1494435/


All Articles