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. Required fields are marked *