for (String check : partresult) {
int count=checkDiff(check,endword);
if (count < min) {
min = count;
Iterator itr = res.iterator();
while(itr.hasNext()) {
Object elem=itr.next();
if (checkDiff(elem.toString(), endword) != min)
res.remove(elem);
}
res.add(check);
}
}
for this piece of code, I have java.util.ConcurrentModificationException in the res.remove(elem). I already used an iterator, so really do not know what is wrong, hope somebody could help. thanks