wood burning stoves 2.0*
The moose likes Performance and the fly likes Performance of ArrayList and Vector Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Performance
Bookmark "Performance of ArrayList and Vector" Watch "Performance of ArrayList and Vector" New topic

Performance of ArrayList and Vector

Erik Hu

Joined: Dec 05, 2001
Posts: 6
Hi, all
I've done some test, but can not see the difference of ArrayList and Vector, anyone who has some better suggestion?
dan moore
Ranch Hand

Joined: Nov 04, 2001
Posts: 68
compared on performance (not behaviour)? what were your results?

dan moore, infomatiq ltd.<br />email dan@infomatiq.co.uk<br /><a href="http://www.infomatiq.co.uk" target="_blank" rel="nofollow">http://www.infomatiq.co.uk</a>
kumud sharma

Joined: Jan 31, 2001
Posts: 4
Vectors are always the prefered data structure as internally it implements arrays.
David Weitzman
Ranch Hand

Joined: Jul 27, 2001
Posts: 1365
(Copy of an answer I posted in a different forum)
The simple answer: ArrayList is faster
Why? Vector has been around longer and developed into a sort of be-all do-all class with synchronization and support for many different API. ArrayList is a straitforward implementation of a List with no whistles or bells.
Jamie Robertson
Ranch Hand

Joined: Jul 09, 2001
Posts: 1879

http://www.javaranch.com/ubb/Forum1/HTML/002196.html http://www.javaranch.com/ubb/Forum15/HTML/000285.html http://www.javaranch.com/ubb/Forum15/HTML/000039.html
here are some good discussions on this topic
It is sorta covered in the JavaRanch Style Guide.
subject: Performance of ArrayList and Vector
Similar Threads
Multiple Thread allow to change single variable
Difference B/w ArrayList & Vector
type casting
Array List vs Vector