Skip to Main Content

Java Programming

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!

map.remove... How do I get it to work?

807588Aug 5 2009 — edited Aug 5 2009
hi all!

I have a quick question that may be impossible.

I have a map object (myMap) that is populated with key value pairs

Im trying to remove a key, based on its String value (as opposed to its key value)

when I call

myMap.remove("myName"); //

I get the error:
incompatible types
found : java.lang.Object
required: java.lang.String

i tried casting it to an object - which obviously failed, but how can I get this to work?!?!
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 2 2009
Added on Aug 5 2009
18 comments
426 views