Vector

Vector

  • The underlying data structure is resizable or growable Array.
  • Insertion order is preserve.
  • Duplicate objects are allow.
  • Null insertion is possible.
  • Hetrogenious objects are allow.
  • Vector class implements Serializable, Clonable & RandomAccess interface.
  • Best suitable for frequent operation is retrieval.
  • Worst  choice is frequent operation is insertion or deletion on middle.
  • Every method present in Vector class is Synchronized. Hence vector object is thread safe.
Different between ArrayList and Vector:-
ArrayList
Vector
  • no method is synchronized 
  • ArrayList objects is not thread safe
  • performance is high
  • introduced in 1.2 version and hence non legacy

 

 

  • All  method is synchronized 
  • vector objects is always thread safe
  • performance is low
  • introduced in 1.0 version and hence vector is legacy

 

 

 

 

The Author

Narayanaswamy

Hello! I am Narayanaswamy founder and admin of narayanatutorial.com. I have been working in IT industry more than 7 years. NarayanaTutorial is my web technologies blog. My specialties are Java / J2EE, Spring, Hibernate, Struts, Webservices, PHP, Oracle, MySQL, SQLServer, Web Hosting and Website Development. I am a self learner and passionate about training and writing. I am always trying my best to share my knowledge through my blog.

Leave a Reply