WIldcard inconsistency?
Why is this possible?
import java.util.*;
publicclass Test{
import java.util.*;
publicclass Test{
publicstaticvoid main(String[] args){
Map<String,Map><String,?>> mapOfMaps =
new HashMap<String,Map><String,?>>();
Map<String, Integer> stringToInteger =new HashMap<String,Integer>();
stringToInteger.put("bar", 350);
mapOfMaps.put("key1", stringToInteger);
Map<String,String> stringToString =new HashMap<String,String>();
stringToString.put("bar","foo" );
mapOfMaps.put("key2", stringToString );
}
}
This code works and effectively allows the storeage of both Map<String, Integer> and Map<String, String> types in parameterised type, turning it into a heterogeneous collection. Why does the compiler not prevent calling 'put' in the ususal way?

