While running the following code snippet at some scenario, I got the java.util.ConcurrentModificationException exception.
Please advice: How to avoid it? what can be the worse scenario which ConcurrentModificationException can create? will it occupy the CPU Usage %? Any pointer would be great!!!
public Map someMethod() { Map actionDosMap =new HashMap(); List associatedActionsDos =new ArrayList(); List associatedActionsPerformanceDos =new ArrayList(); Iterator iterActions =associatedActions.iterator(); while (iterActions.hasNext()) { Iterator reposIt = reposSet.iterator(); while (reposIt.hasNext()) { RepoRow row = (RepoRow) reposIt.next(); Properties props = row.getProperties(); DoData performanceReportsDo = new DoData(); if ("PerformanceReports".equals(props.getStringValue(do_type))) { performanceReportsDo.setDoType(doType); performanceReportsDo.setDoId(doID); associatedActionsPerformanceDos.add(performanceReportsDo); } else { DoData doc = new DoData(); doc.setDoType(doType); doc.setDoId(doID); associatedActionsDos.add(doc); } } } actionDosMap.put("performanceReportsDo",associatedActionsPerformanceDos); actionDosMap.put("actionsNonPerfoDo",associatedActionsDos); return actionDosMap; }