Eclipse is giving me a warning of the following form:
Type safety: Unchecked cast from Object to HashMap
This is from a call to
I may have misunderstood the question(an example and a couple of surrounding lines would be nice), but why don't you always use an appropriate interface (and Java5+)? I see no reason why you would ever want to cast to a HashMap
instead of a Map
. In fact, I can't imagine any reason to set the type of a variable to HashMap
instead of Map
.
And why is the source an Object
? Is it a parameter type of a legacy collection? If so, use generics and specify the type you want.