Difference between ArrayList and Vector in java
Tutorials Shared by the Internet Community
Total Hits - 30796
Total Votes - 225 votes
Vote Up - 87 votes
Vote Down - 138 votes
Domain - beginnersbook.com
Category - JAVA/Collections
Submitted By - Chaitanya
Submitted on - 2013-12-22 06:46:45
This is the most frequently asked interview question. Sometimes Vector is better; sometimes ArrayList is better; sometimes you don't want to use either. There are four factors to consider when there is choice between ArrayList and Vector. Based on these factors we can identify which is the most suitable collection that suits the requirement: The factors are:
Vector is not synchornized while ArrayList is synchronized so if there is a need to perform thread-safe operations Vector can be used.
In this tutorial we will see many other differeneces between these classes along with the way to synchronize the ArrayList explicitly. More detail...