对于Map
本身我该怎么做
Map<Object, Object> map1 = new HashMap<Object, Object>();
但对于Map
中的Map
,我无法做到
Map<Object, Map<Object, Object>> map2 = new HashMap<Object, HashMap<Object, Object>>();
相反,我必须做
Map<Object, HashMap<Object, Object>> map3 = new HashMap<Object, HashMap<Object, Object>>();
这种情况并非Maps
所独有,它也与Set
有关,我假设所有其他接口。换句话说,我不能将接口用作泛型。为什么不呢?