を上げることなくArrayListのから要素を削除するコードは次のとおりです。彼らは別のものに存在している場合はここにConcurrentModificationException
Ledger obj = null;
MyUtilPojo obj1 = null;
Iterator it = toList.iterator();
while (it.hasNext()) {
obj = (Ledger) it.next(); //after first iteration next here produce an error
Iterator it1 = moreToList.iterator();
while (it1.hasNext()) {
obj1 = (MyUtilPojo) it1.next();
if (obj.getId() == obj1.getKey()) {
toList.remove(obj);
}
}
}
このエラーConcurrentModificationException
を上げ、誰かが助けることができますか?
も参照してください。http://stackoverflow.com/a/4103007/180100 –
行う 'it.remove()' – irreputable