Friday 1 August 2014

Array Vs ArrayList

  1. ArrayList is internally backed by Array in Java. So the performance for getting and replacing the elements based on index is similar for both the Arrays and ArrayLists. But, If ArrayList filled completely, then it performs resizing, this automatic resizing slow down the performance. But this performance issue is minimal.
  2. Array is a fixed length data structure, where as ArrayList is variable length collection.
  3. It is possible to store both primitive and objects in array. But ArrayList not support primitive types.



                                                             Home

No comments:

Post a Comment