List Interface - ArrayList

List Interface

Vector(old) and ArrayList(new) are almost same. ArrayList is advanced version of Vector. Vector has Syncronization and Array doesn't have.

  • Deleting Data Process of ArrayList

  1. Copy and following data. (When Deleting last data, it will be skipped.)

  2. Last data is changed to null.

  3. Decrease size.

When deleting from the first, Copying data does occured.

for(int i = 0; i < list.size();i++) 
    list.remove(i);

When deleting from the last, Copying data does not occured.=>Much faster!

for(int i = list.size(); i >= 0;i--) 
    list.remove(i);

Last updated

Was this helpful?