JAVAutil。Groovy中的ConcurrentModificationException
我有一段代码:
void remove(){
boolean allowRemove = false;
violations.each{
if(it.selected) allowRemove = true;
}
if(!allowRemove) throw new Exception("No item selected!");
if(allowRemove){
def templist = violations;
templist.each{ if(it.selected) templist.remove(it) }
violations = templist;
tableHandler.reload();
}
}
每次执行此代码时,我的应用程序都会抛出一个错误:java.util.ConcurrentModificationException
。我找到了一个关于如何使用Iterator
在Java中解决这个问题的答案。但我不知道如何在Groovy
中编码。知道吗
共 (0) 个答案