Starting from Java-11, one can alternatively use the API Collection.toArray(IntFunction generator) to achieve the same as:
List list = List.of("x","y","z");
String[] arrayBeforeJDK11 = list.toArray(new String[0]);
String[] arrayAfterJDK11 = list.toArray(String[]::new); // similar to Stream.toArray