Java List convert to an array via Stream
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); }/* ww w .j a va 2 s. c om*/ } }