java.util.ConcurrentModificationException in Groovy -


i have piece of code:

       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();             }         } 

everytime code executed, application throws error: java.util.concurrentmodificationexception. found answer on how resolve in java using iterator. don't know how code in groovy. idea?

doesn't do

violations = violations.findall { !it.selected } 

Comments