Java Stream convert List to Array
import java.util.ArrayList; import java.util.List; public class Main { public static void main(String[] args) { List<Integer> myList = new ArrayList<Integer>(); myList.add(Integer.valueOf(5)); myList.add(Integer.valueOf(7)); myList.add(Integer.valueOf(15)); Integer[] myArray = myList.stream().toArray(Integer[]::new); for (Integer myInt : myArray) { System.out.println(myInt); }/*from ww w . j a v a 2 s. c o m*/ } }