List<String> strings;
void takeParams(String... params);
How can I pass the list into that a method only taking varargs?
strings.toArray(); is not possible as it returns Object[].
List<String> strings;
void takeParams(String... params);
How can I pass the list into that a method only taking varargs?
strings.toArray(); is not possible as it returns Object[].
Use the List#toArray(T[]) method to create an array from the list, and pass it.
takeParams(strings.toArray(new String[strings.size()]));