我在这条线得到一个错误的方法把(字符串,ArrayList的<Integer>)在类型TreeMap的<字符串,ArrayList的<Integer>>不适用的参数(字符串,布尔值)
tm.put(temp[j],tm.get(temp[j]).add(i));
时我是编译我的程序在eclipse:
The method put(String, ArrayList<Integer>) in the type TreeMap<String,ArrayList<Integer>> is not applicable for the arguments (String, boolean)
以下是我的代码:
TreeMap<String, ArrayList<Integer>> tm=new TreeMap<String, ArrayList<Integer>>();
String[] temp=folders.split(" |,");
for (int j=1;j<temp.length;j++){
if (!tm.containsKey(temp[j])){
tm.put(temp[j], new ArrayList<Integer>(j));
} else {
tm.put(temp[j],tm.get(temp[j]).add(j));
}
}
的文件夹是这样
folders="0 Jim,Cook,Edward";
我不知道为什么没有错误对前者把方法,但仅在第二个。
抛出什么错误? –