盡管使用synchronized,ConcurrentModificationExceptionpublic synchronized X getAnotherX(){
if(iterator.hasNext()){
X b = iterator.next();
String name = b.getInputFileName();
...
return b;
}
else{return null;}
}盡管聲明頭中的synchronized語(yǔ)句,我仍然在我使用iterator.next()的行中得到一個(gè)ConcurrentModificationException異常; 什么錯(cuò)了?
盡管使用synchronized,ConcurrentModificationException
尚方寶劍之說(shuō)
2019-07-23 15:32:36