Example & Tutorial understanding programming in easy ways.

What is difference between ArrayList and vector?

Following are some difference as : 

                                       ArrayList                              Vector
1 ArrayList is not thread-safe or ArrayList is not synchronized. 1 Vector is thread-safe or Vector is synchronised. This mean
 
2 For ArrayList when we are adding by using add() method or we are retiring by using get(int i) methods , we can use both or same methods at same time. 2 For Vector we canít use both or same methods at same time.
 
3 ArrayList increases its array size by 50 percent. 3 A Vector defaults to doubling the size of its array .
 
4 ArrayList is not a legacy class. 4 Vector is a legacy class.
 
5 Introduced in jdk 1.2 . 5 Introduced in jdk first version.
 
6 Use index based insertion and searching. 6 Use index based insertion and searching.
 
7 Use dynamic resizing array internally as data structure. 7 Use dynamic resizing array as data-structure internally



Read More →