Friday, June 5, 2020

Differences between ArrayList and Vector

What are the differences between ArrayList and Vector?


ANS) Both ArrayList and Vector classes implements List interface and both are list classes. But they have some differences in their behavior , they are listed below :

ArrayListVector
ArrayList is not a legacy class.Vector is a legacy class.
ArrayList is not synchronized.Vector is synchronized.
ArrayList increases its size by 50% of the array size.Vector increases its size by doubling the array size.
ArrayList is not thread-safe as it is not synchronized.Vector is thread-safe as its all methods are synchronized by default.
 

No comments:

Post a Comment

Hello Buddy, if you have any doubts or need any clarification , feel free to comment. Thanks.