Difference between ArrayList & Vector ::
ArrayList | Vector |
Every method present in arraylist is non-synchronized | Every method present in vector is synchronized |
At a time multiple threads are allowed to operate on arraylist object and hence it is not thread safe | At 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 object | Relatively performance is low because threads are required to wait to operate on vector object |
Introduced in 1.2 version and it is non-legacy | Introduced 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 capacity | Double 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.