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!

Can't set Map<String, Object> with Map<String, String>

416044May 31 2006 — edited Jun 13 2006
I have a method with a Map<String, Object> parameter:
public void do1(Map<String,Object> map) {
    ...
}
I can call this method with a Map<String, Object> parameter value but get a compile error when I try to call it with a Map<String, String> parameter value:

The method do1(Map<String,Object>) in the type Translator is not applicable for the arguments (Map<String,String>)

But why? String is a subclass of object so it should also work?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 11 2006
Added on May 31 2006
16 comments
4,833 views