• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Getting rid of unchecked operations related to Vector class

 
Tobie Henderson
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic