ContactUs :

Please send your Questions & Answers or Feedback to "mohan@javabook.org"

Difference between Vector and ArrayList?

Vector is synchronized whereas arraylist is not.
The Vector class provides the capability to implement a growable array of objects. ArrayList and Vector class both implement the List interface. Both classes are implemented using dynamically resizable arrays, providing fast random access and fast traversal. In vector the data is retrieved using the elementAt() method while in ArrayList, it is done using the get() method. ArrayList has no default size while vector has a default size of 10. when you want programs to run in multithreading environment then use concept of vector because it is synchronized. But ArrayList is not synchronized so, avoid use of it in a multithreading environment.
Related Posts Plugin for WordPress, Blogger...
Flag Counter