1. Synchronization

ArrayList is not Synchronized, That means multiple Threads can work on ArrayList Object at a same time. For e.g. if one thread is performing an add operation on ArrayList, there can be an another thread performing remove operation on ArrayList at the same time in a multithreaded environment.

Vector is Synchronized, That means if one Thread is working on it then other Thread can not work on until previous Thread release it.

2. Resize

Both are dynamic in size, But when they reached to its max limit and resize of storage is different. ArrayList grows by half [50%] of its size when resized while Vector doubles[100%] the size of itself when resized.

3. Performance

ArrayList gives better performance compare to Vector as its not Synchronized. Vector having poor performance as it is Synchronized, Thread which works on Vector holds lock on it which makes other Thread to wait until it release.

4. Enumerator

Other than Hashtable ,Vector is the only other class which uses both Enumeration and Iterator .While ArrayList can only use Iterator for traversing an ArrayList.

5. Introduction in Java

ArrayList was introduced in Java Version 1.2 however Vector was present since first version of Java.

Vector is a legacy class. Its re-structured and re-engineered to support generic from Java 1.5 version onward.

6. Example

John Rob Michel Walter
It's good to share...Share on FacebookTweet about this on TwitterShare on LinkedInPin on PinterestShare on Google+Email this to someone

Leave a Reply

Your email address will not be published. Required fields are marked *