Selasa, 27 Juli 2021

How to Convert List of Integers to Int Array in Java - Example

So, you have a List of Integers and you want to convert them into int array? Yes, you read it write, not on Integer array but int array. Though in most practical purpose, Integer array can be used in place of int[] because of autoboxing in Java, you still need an int[] if your method accepts it. In Java, you can not typecast an Integer array into an int array. Many Java programmer think about toArray() method from java.util.List to convert a List into Array, but unfortunately, toArray() is useless most of the time. It doesn't allow you to convert List into primitive arrays.

Lorem ipsum is simply dummy text of the printing and typesetting industry.

Comments


EmoticonEmoticon