I need to pass arguments to a java method func(String, String...)
.
Problem is I have all the strings I need to pass as arguments, but they are in an ArrayList
container.
For Example:
for(...some condition...)
{
//the other method returns an ArrayList with different size in each iteration
ArrayList <String> values = someOtherMethod();
func(values) //values is an ArrayList<String>, containing all the arguments
}
I get an error saying that ArrayList<String>
can't be converted to String
.
The size of values changes, because the someOtherMethod
method returns a container with different size each iteration, so I can't pass values[0], values[1], etc
as arguments.
I'm guessing the func
wants an X amount of String variables, but I don't know how to convert a container to an X amount of variables when the size of the container isn't constant.