Sunday, 18 January 2015

Difference between ArrayList and Vector


Difference between ArrayList and Vector comes under Core Java interview questions.It is the most basic questions asked to check the interviewee basic knowledge of Collection before going deep in Collection.


                                                         ArrayList Vs Vector




              ArrayList
                Vector
 Synchronization
 ArrayList in not synchronized means it is not suitable for multi-threaded environment.

 Vector is synchronized.
 Performance
 Arraylist are faster as it is not synchronized.

 Vector performance is slow as they are thread safe.
 Resize
 ArrayList grow half of its size when resized.

 Vector grow double of its size when resized.
 Iteration method
 ArrayList does not uses enumerator for iteration.

 Vector uses enumerator for  iteration.



Read carefully and understand the difference.
Enjoy Reading

No comments:

Post a Comment