It is important to understand the meaning of wildcard types.
, Map<Integer, Map<Integer, String>> Map<?, ?>, Map<?, ?> , , Map<?, ?>. , Map<?, ?>.
, Map<?, Map<?, ?>>, , . Map<?,?>, , .
, :
Map<?, Map<?, ?>> map=new HashMap<>();
map.put(null, Collections.<String,String>singletonMap("foo", "bar"));
map.put(null, Collections.<Double,Integer>singletonMap(42.0, 1000));
map.put(null, Collections.<Object,Boolean>singletonMap(false, true));
null, put - , , Map<?, ?>: . , null , .
, , Map<Integer, Map<Integer, String>> Map<?, Map<?, ?>> , Map<Integer, String> , , .
, , - , , , , , :
Map<Integer, Map<Integer, String>> someMap = new HashMap<>();
Map<?, ? extends Map<?, ?>> map=someMap;
Map<Integer, String> Map<?, ?>, Map<?, ?>, ? extends Map<?, ?>. String Object. String Object, Map<?,String>, Map<?,Object>, Map<?, ? extends Object> : String , .
, . :
Map<Integer, Map<Integer, String>> someMap = new HashMap<>();
Map<?, Map<?, ?>> map=Collections.unmodifiableMap(someMap);
, unmodifiableMap, , . (.. Map<?, ?>) , , , .