jQuery in Action, 3rd edition
The moose likes Java in General and the fly likes Array List vs Vector Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Array List vs Vector" Watch "Array List vs Vector" New topic

Array List vs Vector

Muhammad Aasim

Joined: Oct 16, 2009
Posts: 9
What is difference between ArrayList and Vector? In which situation we use arrayList and Vector?

Answer:-ArrayList is like a resizeable array. ArrayList actually comes as a replacement the old "Vector" Collection. As we add or remove elements into or from it, it grow or shrinks over time?

Any thing else may please be tell?

EveRy THinG is pOssiBle bUt LovE caN NaveR FOr Me...
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
One difference is that the methods in Vector are all synchronized, whereas the methods in ArrayList are not. That's important in multi-threaded environments.
Fredrik Larsback

Joined: Dec 21, 2009
Posts: 9
Vector is synchronized, ArrayList isn't.
Kaustav Ganguly

Joined: Dec 14, 2009
Posts: 28
First thing is Vector also implements a resizable array like ArrayList, so both are resizable data structures. Vector class is there in Java since the begining and ArrayList was intoduced as part of the Collection framework. Vector class is also retrofitted into the java collection framework to implement the List interface in Java 2 v1.2 . And finally Vector is synchronized and ArrayList is not.
I agree. Here's the link: http://aspose.com/file-tools
subject: Array List vs Vector
It's not a secret anymore!