This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Array List vs Vector

 
Muhammad Aasim
Greenhorn
Posts: 9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Ulf Dittmer
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Greenhorn
Posts: 9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Vector is synchronized, ArrayList isn't.
 
Kaustav Ganguly
Greenhorn
Posts: 28
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic