aspose file tools*
The moose likes Beginning Java and the fly likes Getting rid of unchecked operations related to Vector class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Getting rid of unchecked operations related to Vector class" Watch "Getting rid of unchecked operations related to Vector class" New topic
Author

Getting rid of unchecked operations related to Vector class

Tobie Henderson
Greenhorn

Joined: Nov 15, 2004
Posts: 20
Hey, I am writing a class called Pair which extends the Vector class. The constructor and add methods are the same as the Vector class. So I can create a new Pair object by:



Now, I want to add objects of another user-defined class called Player to this Pair object.



This is a problem, because it gives me "unchecked operation" errors because the raw type of Vector is not matching. How do I get rid of them? Do I have to override the constructor or the add method of the Vector class in a particular fashion to get rid of this error?
[ December 08, 2004: Message edited by: Tobie Henderson ]
Tobie Henderson
Greenhorn

Joined: Nov 15, 2004
Posts: 20
FWIW, I solved the problem. I just changed the class definition of Pair to which was previously:



to:



so that it can handle Player objects. Then I create a new Pair object by saying:



That's it.
 
jQuery in Action, 2nd edition
 
subject: Getting rid of unchecked operations related to Vector class