I have a question regarding generics:
Code: Select all
Map<? super String, ? super String> mappa1 = new HashMap<Object,Object>();
However then you can add only objects which extends String ( in this case only String itself).
Why don't they forbid by compilation error as well as happens with the "extends" wildcard.
I mean if once created a map of Object, Object and then it's possible only to add Strings.. why not forcing to create a map of String, String in the first place?
Thanks a lot in advance.
The_Nick.