wood burning stoves 2.0*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Generics Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Generics" Watch "Generics" New topic
Author

Generics

Nikhil Jain
Ranch Hand

Joined: May 15, 2005
Posts: 385


Eclipse gives a warning for the above code.
Type safety: The cast from Object to HashMap<String,Object> is actually checking against the erased type HashMap

How will we return something of object type in generics without getting the warning ...


SCJP 1.4, SCWCD 1.4, SCBCD 1.5
Kaydell Leavitt
Ranch Hand

Joined: Nov 18, 2006
Posts: 689

I'm not sure why, but I believe that you need to replace <String, Object> with <String, ?>
 
 
subject: Generics