Hello, I am trying to add an argument from Kotlin ...
# server
m
Hello, I am trying to add an argument from Kotlin to a function of java class. The java function is like this.
Copy code
public void setActiveProfiles(String... profiles) {
     // something something
} // java file
The most positive way to do it for me is like this one.
Copy code
javaClass.setActiveProfiles("a", "b", "c", "d", "e") // kt file
But I need to make those
strings
dynamic. What should be the best way to do it?
e
what exactly do you mean by "dynamic"?
s
Copy code
val args = arrayOf("a", "b", "c", "d", "e")
javaClass.setActiveProfiles(*args)
☝️ 1
K 1
❤️ 1
Note the
*
, it's the important bit
m
Thanks a lot @Sam That's perfect for me.
🐕 1
@Emil Kantis Sorry if I used the confused word. I was trying to say that I want to accept string array as a parameter from another function.
👍 1