como faço para remover um objeto durante uma iteração?
Dá erro de ConcurrentModificationException....
meu codigo
public void removeChild(TreeNode treeNo, Integer inti){
Iterator<Map.Entry<Integer,TreeNode>> it = treeNo.getChildren();
TreeNode no;
TreeNode nodo = treeNo.getParent();
if (it.hasNext()){
Map.Entry<Integer, TreeNode> temp = it.next();
int i=0;
System.out.println(temp.getKey() + " - " + temp.getValue());
// allTree(temp.getValue(), temp.getKey().toString());
Funcionalidade f= (Funcionalidade)temp.getValue().getData();
treeNo.removeChild(f.getId());
}
FacesContext context = FacesContext.getCurrentInstance();
context.getApplication().createValueBinding("#{simpleTreeBean.treeNode}").setValue(context,
rootNode);
}