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 :
This blog explains the installation and usage of the Java programming language. It also contains examples for standard programming tasks.This is used to enhance the java programming skills.
ArrayList | Vector |
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.