我得到CurrentModificationException
,我不知道爲什麼。這是我的代碼:當前修改例外Android迭代器
Iterator<Ficha> itFichas = puzzle.iterator();
Iterator<Integer> index = randomNum.iterator();
while(itFichas.hasNext() && index.hasNext()){
PAleatorio.add(index.next(),itFichas.next());
}
我已經定義puzzle
爲ArrayList<Integer>
。和randomNum
,PAleatorio
作爲ArrayList<Ficha>
。
爲什麼我會得到異常?
編輯:
ArrayList<Ficha> finalList = new ArrayList<Ficha>();
finalList.add(new Ficha("1"));
finalList.add(new Ficha("2"));
finalList.add(new Ficha("3"));
finalList.add(new Ficha("4"));
可以顯示的聲明** ** PAleatorio只是 –
發佈更多的上下文的位和異常的堆棧跟蹤。 – Blackbelt
在所有概率中,「難題」和「PAleatorio」指的是同一個對象。 – Rajesh