File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ArrayList vs. Vector

 
Shenaz Assu
Ranch Hand
Posts: 32
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey.. i know this question has been asked a 1000 times.. but still, wats the difference?? Other than Vector being Thread safe of course. I was asked this question in a interview and the interviewer was not happy at my answer about vector being thread safe is the only difference. He insisted that there are much more differences. Can anyone help me out??
[ October 03, 2007: Message edited by: Shenaz ]
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Pie
Posts: 15150
31
Android IntelliJ IDE Java Scala Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Shenaz, welcome to JavaRanch.

First, please check your private messages. You can see them by clicking My Private Messages.

Vector is a legacy collection class, from the time of Java 1.0. In Java version 1.2, new collection classes were added that more or less replace the old classes. ArrayList is more or less the replacement of Vector.
 
bart zagers
Ranch Hand
Posts: 234
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Take a look at this link for a technical comparison.
But I also think the most important difference is the fact that Vector is a legacy class (prior to java 1.2). When you only mention thread-save, you seem to imply that both can be valid choices, but almost always you should prefer ArrayList.
 
Shenaz Assu
Ranch Hand
Posts: 32
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Bart. The link was very useful.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic