【发布时间】:2016-01-13 08:47:48
【问题描述】:
我声明了 hashmap; String 作为键,String 的 ArrayList 的 ArrayList 作为值。
public Map<String,ArrayList<ArrayList<String>>> idPathMap = new HashMap<String,ArrayList<ArrayList<String>>>();
但它显示错误:HashMap 类型不是通用的;它不能用参数<String, ArrayList<ArrayList<String>>>进行参数化
如何声明这种类型的HashMap?
【问题讨论】:
-
你在导入什么
HashMap?对我来说似乎没问题(Java 8) -
Map<String, ArrayList<ArrayList<String>>> idPathMap = new HashMap<String, ArrayList<ArrayList<String>>>();在 Java 8 中没有给出任何错误 -
检查你的进口,也许你正在使用旧的..
-
导入是 java.util.Map
-
@YuWaiHlaing 它工作正常........没有错误