Thursday 8 November 2012

Vector Vs ArrayList which is preferable

Vector Vs ArrayList

We can compare this two based on some parameters....like Synchronization, DataSize

1)Vector is synchronized while Arraylist is not synchronized.Synchronization always pay for efficiency,so it is better to use ArrayList if we don't need thread safe data acces,Other wise go for Vector.

2)The size always matters,--Both vector and ArrayList are resizable(dynamic for their size),
but when size increase..Vector increase it's size by double and on the other hand ArrayList increases it's size by half of  its previous size.So it is better to use ArrayList wrt size.

3)Arraylist are faster and speedup the execution while vector are less efficient than ArrayList.

4)Vector is threadsafe while ArrayList is not threadsafe.

No comments:

Post a Comment