Source:
<code>public boolean revealElement(Collection<?> elements) { boolean selectObject = false; SelectionLayer selectionLayer = bodyLayerStack.getSelectionLayer(); List<Object> rowObjects = getRowElementsList(); List<Object> columnObjects = getColumnElementsList(); selectionLayer.clear(); for (int rowIndex = 0; rowIndex < rowObjects.size(); rowIndex++) { List<?> toFind = new ArrayList<Object>(elements); ArrayList realObjects = new ArrayList<Object>(); for (Object object : elements) { if (object instanceof EObjectAxis) { Object realObject = AxisUtils.getRepresentedElement(object); <START> realObjects.add(realObject); <END> } } toFind.addAll(realObjects); Object currentAxisObject = rowObjects.get(rowIndex); Object currentRealObject = AxisUtils.getRepresentedElement(currentAxisObject); if (toFind.contains(currentRealObject)) { selectionLayer.doCommand(new SelectRowsCommand(selectionLayer, 0, rowIndex, false, true)); toFind.remove(currentRealObject); selectObject = true; } if (toFind.isEmpty()) { return selectObject; } } for (int columnIndex = 0; columnIndex < columnObjects.size(); columnIndex++) { List<?> toFind = new ArrayList<Object>(elements); ArrayList realObjects = new ArrayList<Object>(); for (Object object : elements) { if (object instanceof EObjectAxis) { Object realObject = AxisUtils.getRepresentedElement(object); realObjects.add(realObject); } } toFind.addAll(realObjects); Object currentAxisObject = columnObjects.get(columnIndex); Object currentRealObject = AxisUtils.getRepresentedElement(currentAxisObject); if (toFind.contains(currentRealObject)) { selectionLayer.doCommand(new SelectColumnCommand(selectionLayer, columnIndex, 0, false, true)); toFind.remove(currentRealObject); selectObject = true; } if (toFind.isEmpty()) { return selectObject; } } return selectObject; }</code><technical_language>create intermediate list? (toFind is a copy of elements, ConcurrentModificationException happen here)</technical_language>

Target:
public boolean revealElement(Collection<?> elements) { boolean selectObject = false; SelectionLayer selectionLayer = bodyLayerStack.getSelectionLayer(); List<Object> rowObjects = getRowElementsList(); List<Object> columnObjects = getColumnElementsList(); selectionLayer.clear(); for (int rowIndex = 0; rowIndex < rowObjects.size(); rowIndex++) { List<Object> toFind = new ArrayList<Object>(elements); for (Object object : elements) { Object realObject = AxisUtils.getRepresentedElement(object); if (!realObject.equals(object)) { toFind.add(realObject); } } Object currentAxisObject = rowObjects.get(rowIndex); Object currentRealObject = AxisUtils.getRepresentedElement(currentAxisObject); if (toFind.contains(currentRealObject)) { selectionLayer.doCommand(new SelectRowsCommand(selectionLayer, 0, rowIndex, false, true)); toFind.remove(currentRealObject); selectObject = true; } if (toFind.isEmpty()) { return selectObject; } } for (int columnIndex = 0; columnIndex < columnObjects.size(); columnIndex++) { List<Object> toFind = new ArrayList<Object>(elements); for (Object object : elements) { Object realObject = AxisUtils.getRepresentedElement(object); if (!realObject.equals(object)) { toFind.add(realObject); } } Object currentAxisObject = columnObjects.get(columnIndex); Object currentRealObject = AxisUtils.getRepresentedElement(currentAxisObject); if (toFind.contains(currentRealObject)) { selectionLayer.doCommand(new SelectColumnCommand(selectionLayer, columnIndex, 0, false, true)); toFind.remove(currentRealObject); selectObject = true; } if (toFind.isEmpty()) { return selectObject; } } return selectObject; }