hwo to convert list to array in java code example
Example 1: java array to list
Integer[] spam = new Integer[] { 1, 2, 3 };
List<Integer> list = Arrays.asList(spam);
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-