File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Is Vector an obsolete collection class?

 
Bemeshmathu Kutty
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 172
Clojure Java Linux
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Nicolas Zozol
Ranch Hand
Posts: 33
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Roel De Nijs
Sheriff
Posts: 9105
75
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Piotr Nowicki
Ranch Hand
Posts: 610
IntelliJ IDE Java Linux
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am also using ArrayList for the data for JTable.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic