problem removing element in while lus
in
Library and Tool Development
•
9 months ago
I get a ConcurrentModificationException and the problem seems to be line 17.
Cause if i comment it out i have no errors.
hope some one can help
Cause if i comment it out i have no errors.
- else if(ctrl) {
- // TOGGLE
- HashSet<CVector> selection = new HashSet<CVector>();
- System.out.println("A");
- for (Layer layer : toolHandler.layerStack.layers) {
- selection.addAll(selection(x1, y1, x2, y2, layer));
- }
- System.out.println("B");
- Iterator<CVector> itr = selection.iterator();
- while(itr.hasNext()) {
- CVector v = itr.next();
- if(toolHandler.layerStack.anchorSelection.contains(v)) {
- toolHandler.layerStack.anchorSelection.remove(v);
- selection.remove(v);
- }
- }
- System.out.println("C");
- toolHandler.layerStack.anchorSelection.addAll(selection);
- }
hope some one can help
1