File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes What is difference between ArrayList and vector? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "What is difference between ArrayList and vector?" Watch "What is difference between ArrayList and vector?" New topic
Author

What is difference between ArrayList and vector?

Mary Jones
Greenhorn

Joined: Apr 22, 2011
Posts: 1
What is difference between ArrayList and vector?
Mohamed Sanaulla
Saloon Keeper

Joined: Sep 08, 2007
Posts: 3070
    
  33

You mean java.util.ArrayList and java.util.Vector ? if yes, please search in Beginners Forums or Java In General forums >> SearchFirst

Update: I asked for the clarification as this was earlier posted in JavaFX forum.


Mohamed Sanaulla | My Blog
Nico Van Brandt
Ranch Hand

Joined: Mar 31, 2011
Posts: 66

Literally from the Java API:

ArrayList
(This class is roughly equivalent to Vector, except that it is unsynchronized.)


Vector
Unlike the new collection implementations, Vector is synchronized.


Oracle Java SE6 Certified Programmer
Oracle Java EE5 Certified Web Component Developer
swapnil kataria
Ranch Hand

Joined: Feb 26, 2011
Posts: 64
as said above vector is synchrnoized and 2nd thing vector are accessible by iterator and enumeration both,
Randall Fairman
Greenhorn

Joined: Apr 18, 2011
Posts: 29

ArrayList is much faster than Vector, and only takes something like 10% more time to access than a simple array. I forget exactly where I saw this, but it wouldn't be a very hard thing to verify for yourself.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19693
    
  20

Much faster? Perhaps a few Java versions ago when the (mostly unnecessary) synchronization had a bigger performance hit, but these days the difference in performance is probably minimal.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38788
    
  23
. . . and welcome to the Ranch Mary Jones.
bit developer
Greenhorn

Joined: Feb 03, 2013
Posts: 2

There are a few differences between arraylist and vector. Visit this link for the differences:
http://www.questionscompiled.com/answer.jsp?technology=java&qid=53

Winston Gutkowski
Bartender

Joined: Mar 17, 2011
Posts: 7779
    
  21

bit developer wrote:There are a few differences between arraylist and vector...

You do realize that you've replied to a post that's nearly two years old? I suspect Mary has left the building.

Winston

Isn't it funny how there's always time and money enough to do it WRONG?
Articles by Winston can be found here
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: What is difference between ArrayList and vector?