有人能告訴我下面的代碼有什麼問題嗎?當我試運行後的第一行代碼如下{產生以下錯誤:使用ArrayList的哈希映射
「java.lang.IndexOutOfBoundsException:指數:0,大小:0」
public static class ASIFFile {
private ArrayList<HashMap<String,String>> data;
private static int currRec = 0; //assign each record a numeric id based on this figure.
// Method for reading ADIFfile
public ArrayList<HashMap<String,String>> ReadASIFfile (File DataFile) {
data = new ArrayList<HashMap<String, String>>(500);
try {
HashMap<String, String> temp = new HashMap<String,String>(10);
data.set(currRec, temp);
(data.get(currRec)).put("recID", Integer.toString(currRec));//give the record a numeric ID
...
第二行吠叫了分號:) – Eich
@Eich啊,這是一個錯誤的複製到文本框。它實際上在代碼 – Adam