Search code examples
javalistvariadic-functions

How to convert a List to variable argument parameter java


I have a method which takes a variable length string (String...) as parameter. I have a List<String> with me. How can I pass this to the method as argument?


Solution

  • String... equals a String[] So just convert your list to a String[] and you should be fine.