-2
我有任务创建一个整数键和整数值的哈希集的值的哈希表。现在,我试过如下:创建一个整数和值为整数的哈希集键的哈希表
HashMap hm= new HashMap(Integer, new HashSet<>());
我曾告诉我说找不到符号整数的错误。任何意见,不胜感激。
我有任务创建一个整数键和整数值的哈希集的值的哈希表。现在,我试过如下:创建一个整数和值为整数的哈希集键的哈希表
HashMap hm= new HashMap(Integer, new HashSet<>());
我曾告诉我说找不到符号整数的错误。任何意见,不胜感激。
在这里,你应该如何申报您的地图:
Map<Integer, HashSet<Integer>> hm = new HashMap<>(); // In Java SE 7, you can substitute the parameterized type of the constructor with an empty set of type parameters (<>)
Map<Integer, HashSet<Integer>> hm = new HashMap<Integer, HashSet<Integer>>(); // version of jdk prior to 7
感谢澄清,亚历克斯。 – nstrong 2015-01-26 22:07:06