This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Java in General and the fly likes Difference b/w Vector and an ArrayList Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "Difference b/w Vector and an ArrayList" Watch "Difference b/w Vector and an ArrayList" New topic
Author

Difference b/w Vector and an ArrayList

Raj Kumar Bindal
Ranch Hand

Joined: Apr 15, 2006
Posts: 409
Please tell me all differences b/w a Vector and an ArrayList
**Plz also tell the situations in which each one of them should be used
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12271
    
    1
Questions such as this are addressed in the JavaDocs for the java.util package. No-one should try to be a Java programmer without knowing how to navigate in the JavaDocs. If you have room on your hard drive why not download and install a copy.
Bill


Java Resources at www.wbrogden.com
naveen gupta
Ranch Hand

Joined: Apr 12, 2006
Posts: 129
Your one stop for clear understanding of differences between collection framework classes

You should be aware of old java collections and new java collections classes

http://www.informit.com/guides/content.asp?g=java&seqNum=95
Srinivas Kalvala
Ranch Hand

Joined: Oct 20, 2005
Posts: 257

Originally posted by Raj Kumar Bindal:
Please tell me all differences b/w a Vector and an ArrayList
**Plz also tell the situations in which each one of them should be used


Hi Raj,

Please download and install the JAVA DOC. It will solve most of your doubts.

There is only one fundamental difference between the Vector and ArrayList, even though both implement from same base interface.

The Vector is synchronized, means it is thread safe. Only one thread of your application can access a vector at a time.

Where as the ArrayList is not synchronized.

As you see, ArrayList gives more performance when you want to access elements from middle of the list and insert and delete in end positions only.

Thank you.

Jesper de Jong
Java Cowboy
Bartender

Joined: Aug 16, 2005
Posts: 12929
    
    3

You posted the same question twice.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Difference b/w Vector and an ArrayList
 
Similar Threads
Vector vs ArrayList
diff b/w vector and array list?
ArrayList vs Vector
Collections ques
Technical Interview Questions