Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

difference between vector and array list

 
vidhyasagar reddy
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hai every body

vector is synchronized and arraylist is not synchronized

can any body explain me what happens we use the vector and arraylist in the servlet.
will it produce the same o/p
or not?
if possible provide me sample code
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24211
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ArrayList is a replacement for Vector. Never use Vector in new code -- only use it when needed to interface with existing code that works with Vector.

I'm going to move this to Java in General (Beginner) for further discussion.
 
Tony Morris
Ranch Hand
Posts: 1608
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When should I use java.util.Vector/java.util.Hashtable?
http://jqa.tmorris.net/GetQAndA.action?qids=53&showAnswers=true
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic