At first glance it is needed just convert collection to array and pass it to method but this does not work:
val toTypedArray = Arrays.asList("a", "b").toTypedArray()
Paths.get("", toTypedArray) // <- compilation error here
If you want to covert it to varargs, you can prefix your array by prepending “*” to the argument:
It’s called spreading operator, as I already described here answer I gave.