Software Development

Converting Between array and List in Java

You can convert arrays to Lists and Lists to arrays.

[wp_ad_camp_1]

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.

[wp_ad_camp_2]

Loading

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