Loading
ArrayList VS Vector

Java Quick Notes

Refresh Your Java - Before Java Interview

We are Agile, believe in less Documentation - Only Quick notes (Java Interview Questions) of Java/J2ee Read more....


Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet

Go to SiteMap

Q)  ArrayList VS Vector


  • ArrayList VS Vector
    Sample Img 2

Ans)

Vectors are synchronized. Any method that touches the Vector's contents is thread safe.
ArrayList, on the other hand, is unsynchronized, making them, therefore, not thread safe.
With that difference in mind, using synchronization will incur a performance hit. So if
you don't need a thread-safe collection, use the ArrayList.

A Vector defaults to doubling the size of its array, while the ArrayList increases its array
size by 50 percent. Depending on how you use these classes, you could end up taking a large
performance hit while adding new elements. It's always best to set the object's initial
capacity to the largest capacity that your program will need. By carefully setting the capacity,
you can avoid paying the penalty needed to resize the internal array later.



Back to top

------------------------- We hope you got necessary Info On -----------------------------------------

ArrayList VS Vector


ArrayList VS Vector

-------------------------------------------------------------------------------------------------------



Face Book
Request for a Mock Interview/Training

Get a PDF

Face Book
Same look (Read) on any device, this is Ads free