What is the difference between Array list and vector?

in progress 0
Studies Neha Sharma 12 months 1 Answer 79 views Silver 0

Answer ( 1 )

  1. ArrayList and Vector both implements List interface and maintains insertion order. But there are many differences between ArrayList and Vector classes as well-
    1. ArrayList is not synchronized whereas vector is synchronized.
    2. ArrayList increments 50% of current array size if number of element exceeds from its capacity whereas Vector increments 100% means doubles the array size if total number of element exceeds than its capacity.
    3. ArrayList is not a legacy class, it is introduced in JDK 1.2 whereas Vector is a legacy class.
    4. ArrayList is fast because it is non-synchronized whereas Vector is slow because it is synchronized i.e. in multithreading environment, it will hold the other threads in runnable or non-runnable state until current thread releases the lock of object.

Leave an answer


Captcha Click on image to update the captcha .

About Neha SharmaSilver