Software Development

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.


Got comments or suggestions? We disabled the comments on this site to fight off spammers, but you can still contact us via our Facebook page!.

You Might Also Like