0

Converting Between array and List in Java

You can convert arrays to Lists and Lists to arrays.

Line 11 specifies the type of the array. The advantage of specifying a size of 0 for the parameter is that Java will create a new array of the proper size for the return value. You can suggest a larger array to be used instead. If the ArrayList fits in the array, it will be returned. Otherwise, a new one will be created.

Karl San Gabriel

Karl San Gabriel

Java and Enterprise Technologies Expert