• Post Reply Bookmark Topic Watch Topic
  • New Topic

Difference b/w Vector and an ArrayList  RSS feed

 
Raj Kumar Bindal
Ranch Hand
Posts: 418
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
naveen gupta
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 257
Firefox Browser Hibernate Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Posts: 16060
88
Android IntelliJ IDE Java Scala Spring
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!