In Java 11, we can use the Collection.toArray(generator)
method. The following code will create a new array of strings:
List list = List.of("one", "two", "three");
String[] array = list.toArray(String[]::new)
from java.base's java.util.Collection.toArray().