Sunday, 13 October 2013

Difference between ArrayList and Vector

Difference between ArrayList and Vector
Vector is Synchronized where as ArrayList is not Synchronized that means methods of Vector (add , remove , etc.. which modifies the vector structurally) are synchronized . If multiple threads access an ArrayList instance concurrently, and at least one of the threads modifies the list structurally, it may lead to unexpected results.
2. Array List is faster comparing to Vector because methods of the ArrayList are not synchronized. So Array List is the better choice for single threaded environment.

3. When Vector crosses the current capacity, it doubles (100% increment) the capacity automatically, where as ArrayList increases its capacity almost by 50%. +1

No comments:

Post a Comment

Very Impotent Links for Java and Portal development development

Jar Download for Spring  Maven Or Gradel Dependency for Spring