aspose file tools
The moose likes Beginning Java and the fly likes Is vector class was deprecated after releasing of Collection Framework Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "Is vector class was deprecated after releasing of Collection Framework" Watch "Is vector class was deprecated after releasing of Collection Framework" New topic
Author

Is vector class was deprecated after releasing of Collection Framework

Ishant Agarwal
Greenhorn

Joined: Sep 09, 2011
Posts: 21
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
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 8441

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


[Donate a pint, save a life!] [How to ask questions] [Onff-turn it on!]
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 32712
    
    4
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Is vector class was deprecated after releasing of Collection Framework
 
Similar Threads
Differentiate ArrayList and Vector
why Map is not under Collection interface?
what is the difference between ArrayList and vector
Generics related warning in Vector add method
New Collections Exam