• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Is vector class was deprecated after releasing of Collection Framework

 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello guys!!!

I am working with Collection framework so while working with it I found a Vector class which implements the List interface so i get little bit confused that vector is a legacy class and it was introduced at the time of releasing java while Collection framework was introduced in java 1.2...

So the question is
Is vector class was again introduced after releasing of java 1.2...

pl help me out to clear my concept....




Regards
Ishant Agarwal
SCJP,SCWCD
 
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you read the API docs,

As of the Java 2 platform v1.2, this class was retrofitted to implement the List interface, making it a member of the Java Collections Framework. Unlike the new collection implementations, Vector is synchronized.



Since your question has nothing to do with GUI, I will move it to a more appropriate forum for you. In future do take out time to CarefullyChooseOneForum
 
Marshal
Posts: 79239
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, java.util.Vector is usually regarded as a legacy class.
No, it is not deprecated; if it were, it would say "deprecated" in the documentation. There is a button in the documentation which gives access to the deprecated classes.
You ought normally to use ArrayList instead of Vector, but there are a few classes which require a Vector. You can find out from the "use" button in the documentation.
I think you ought to use the Collections#synchronizedList(java.util.List) method with an ArrayList, as described in the ArrayList documentation, if you require a synchronised List, rather than Vector.
Vector has some peculiarities, eg this constructor, which many people think you shouldn't use.
It says "retrofitted to implement the Lsit interface." If you go through the documentation looking for "since 1.2" you see lots of methods to implement the List interface were added then.
 
If I had asked people what they wanted, they would have said faster horses - Ford. Tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic