change list to array java code example
Example 1: java list to array
String[] arr = list.toArray(new String[list.size()]);
Example 2: java list to array
List<Foo> list = new ArrayList<>();
Foo[] array = list.toArray(new Foo[0]);
Example 3: convert array to list java
Collections.addAll(list, array);