Skip to Main Content

Java APIs

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

HashMap needs unchecked conversion to conform to HashMap<String, BigDecimal

843793Jul 17 2007 — edited Jul 17 2007
Type safety: The expression of type HashMap needs unchecked conversion to
conform to HashMap<String,BigDecimal>

Sorry about the topic but thats all the characters I could fit.

So I'm trying to make sure all the new code I'm producing these days uses generics, because they're cool and casting all the time is lame.

I've got a HashMap<String, HashMap> that is storing HashMap<String, BigDecimal>

In the context where I'm taking the second HashMap out of the first I've got a line like this:
HashMap<String, BigDecimal> fiscalPeriods = object.get(objectNumber);
And the second half of that expression Eclipse doesn't care for and gives me the aformentioned warning.

Object is declared as such:
private LinkedHashMap<String, HashMap> object = new LinkedHashMap<String, HashMap>();
What could/should I be doing better/different here?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 14 2007
Added on Jul 17 2007
3 comments
5,601 views