Pages

ArrayList VS Vector

Difference between ArrayList & Vector ::



ArrayListVector
Every method present in arraylist is non-synchronizedEvery method present in vector is synchronized
At a time multiple threads are allowed to operate on arraylist object and hence it is not thread safeAt a time only 1 thread is allowed to operate on vector object and hence it is thread safe
Relatively performance is high because threads are not required to wait to operate on arraylist objectRelatively performance is low because threads are required to wait to operate on vector object
Introduced in 1.2 version and it is non-legacyIntroduced in 1.0 version and it is legacy
Allows duplicate and null values.Allows duplicate and null values.
Increase its array size by 50 percent,while adding a new element if it runs out of capacityDouble the size its array size when it is running out of already created objects

























Please comment below to feedback or ask questions.


No comments:

Post a Comment

Please comment below to feedback or ask questions.