aspose file tools*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Is Vector an obsolete collection class? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Is Vector an obsolete collection class?" Watch "Is Vector an obsolete collection class?" New topic
Author

Is Vector an obsolete collection class?

Bemeshmathu Kutty
Greenhorn

Joined: Oct 14, 2010
Posts: 2
Dear Ranchers,
I'm in the middle of completing my URLyBird 1.1.1 assignment and I need a clarification from you. I use Vector class for holding all the Room objects for displaying the Room details in the UI using JTable. I'm using Netbeans IDE for developing my assignment and it is showing a warning for the usage of Vector class. In the explanation about the warning it says:
"This inspection reports any uses of java.util.Vector or java.util.Hashtable. While still supported, these classes were made obsolete by the JDK1.2 collection classes, and should probably not be used in new development."

Though I couldn't see any warnings in the Java™ Platform Standard Ed. 6 API Javadoc, Is it ok for me to use the Vector class? will it be treated as a negative point for the grading?

Thanks in advance.
David Byron
Rancher

Joined: Jan 20, 2009
Posts: 172

Use of a Vector is legal but seems old fashioned. I do not know the specific grading criteria, but I wouldn't be surprised to learn that the graders look for mastery of the Collections API. Certainly, the latter supersedes most (and maybe all) routine uses of the Vector.

Edit: Here's a nice, brief discussion at Stackoverflow.


SCJD 6, OCPJP7, Baroque Potion, G+
Nicolas Zozol
Ranch Hand

Joined: Oct 13, 2009
Posts: 33
Vectors are "Synchronized" and can be used for this reason instead of ArrayList in some special case that nobody remember nor use. I think SCJD will help you to use correctly conccurent problem without falling in bad use of "synchronized" classes.


Robusta Web Library : Open Source for REST & Java
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5408
    
  13

I used a simple ArrayList to hold my objects in my custom table model. But if you want to use Vector class, just go ahead, but I don't see any advantage which justifies using the Vector class in this situation.


SCJA, SCJP (1.4 | 5.0 | 6.0), SCJD
http://www.javaroe.be/
Piotr Nowicki
Ranch Hand

Joined: Jul 13, 2010
Posts: 610

I am also using ArrayList for the data for JTable.


OCP Java SE 6 Programmer, OCM Java SE 6 Developer, OCE Java EE 6 JSPSD, OCE Java EE 6 EJBD, OCE Java EE 6 JPAD, Spring 3.0 Core Professional.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Is Vector an obsolete collection class?