我需要制作一个 ArrayList 列表,我的想法是:
Map<Integer, ArrayList<String>> SentReportMap=new HashMap<Integer, ArrayList<String>>();
那告诉:
Use new SparseArray<ArrayList<String>>(...) instead for better performance
所以,我试试这个:
SparseArray<String> SentReportMap = new SparseArray<String>();
ArrayList<String> items=new ArrayList<String>();
items.add(array.getProperty("To").toString());
items.add(array.getProperty("Date").toString());
SentReportMap.put(1, items);
但是用数据填充这个数组,返回这个错误:
The method put(int, String) in the type SparseArray<String> is not applicable for the arguments (int, ArrayList<String>)
或者
The method put(int, String) in the type SparseArray<String> is not applicable for the arguments (ArrayList<String>, int)
哪里错了,什么是制作数组数组的更好解决方案!?