Difference between ArrayList and Vector in java

Tutorials Shared by the Internet Community


Difference between ArrayList and Vector in java

Difference between ArrayList and Vector in Java programming


  • Total Hits - 34471

  • Total Votes - 231 votes

  • Vote Up - 88 votes

  • Vote Down - 143 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:
•Data growth
•Usage patterns

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...

Broken  |   Save  |   Liked  |   Down

E-Books Store