Question: I want to do something like this:

```
ArrayList<String> strings = new ArrayList<>();

//build a collection of Strings

callMethod(strings);

```

The "callMethod" is legacy (in a legacy project), so I cannot change it.

It's signature is this:

```
private void callMethod(String... input){

// and so forth...

```

How do I pass the collection of Strings to the callMethod method?

Answer: 
Just convert the list to an array of Strings ([varargs turns into an array under the hood](https://docs.oracle.com/javase/specs/jls/se17/html/jls-8.html#jls-8.4.1): *"If the formal parameter is a variable arity parameter, then the declared type is an array type specified by §10.2."*):

```
callMethod(strings.toArray(new String[0]));

```
Convert the list of strings into arrays of strings.

```
ArrayList<String> strings = new ArrayList<>();
callMethod(strings.toArray(new String[strings.size()]));

```