convert list to array list java code example
Example 1: java list to array
String[] arr = list.toArray(new String[list.size()]);
Example 2: convert array to list java
String[] myArray = new String[] { "I", "like", "eating", "pizza" };
List<String> myList = Arrays.asList(myArray);
myList.forEach(string -> System.out.println(string));
// -output-
// I
// like
// eating
// pizza
// -output-