1
我正在嘗試以下內容來更新HashMap
以及學生的新值,請檢查我錯過了什麼地方。訪問相同ArrayList的HashMap
ArrayList<Student> tempStudentList = XMLParser.studentHashMap.get(currentSectionName);
if(studentList==null)
{
Log.v(CURRENT_SCREEN,"created another student list for section name:"+currentSectionName);
tempStudentList = new ArrayList<Student>();
}
Log.v(CURRENT_SCREEN,"Added student to the list");
tempStudentList.add(currentStudent);
XMLParser.studentHashMap.put(currentSectionName, tempStudentList);
什麼問題,你所看到的:此外,Java集合是可變的,在studentHashMap陣列直接,所以你不需要你的地圖上的每個查詢後執行另一個放操縱? – seanhodges 2011-06-13 12:37:15
您沒有給我們足夠的上下文 - 例如,我們不知道發生了什麼問題,或者「學生」來自哪裏。 – 2011-06-13 12:38:01