List to int[] in Java

How to convert a List<Integer> to a int[] in Java 8? Using Java 8 collections stream() function and then mapping to ints, we get an IntStream. With the IntStream we can call toArray() which gives us the int[]

public int[] toIntArray(List<Integer> list){

Leave a Reply

Your email address will not be published.