Source:
<code>private boolean checkForConflict() { TracePackageElement[] packageElements = (TracePackageElement[]) getElementViewer().getInput(); <START> Map<TracePackageExperimentElement, HashSet<String>> experimentElements = new HashMap<>(); <END> List<TracePackageTraceElement> traceElements = new ArrayList<>(); Map<TracePackageExperimentElement, List<TracePackageTraceElement>> experimentTracesMap = new HashMap<>(); List<TracePackageExperimentElement> experimentToRename = new ArrayList<>(); List<TracePackageTraceElement> unhandledTraces = new ArrayList<>(); for (TracePackageElement packageElement : packageElements) { TracePackageTraceElement traceElement = (TracePackageTraceElement) packageElement; if (AbstractTracePackageOperation.isFilesChecked(traceElement)) { if (traceElement instanceof TracePackageExperimentElement) { TracePackageExperimentElement experimentElement = (TracePackageExperimentElement) traceElement; experimentElements.put(experimentElement, new HashSet<>(experimentElement.getExpTraces())); if (experimentExists(experimentElement)) { experimentToRename.add(experimentElement); } } else { traceElements.add(traceElement); } } } for (TracePackageTraceElement traceElement : traceElements) { processTrace(experimentElements, traceElement, experimentTracesMap, unhandledTraces); } boolean result = true; if (!experimentTracesMap.isEmpty() || !experimentToRename.isEmpty()) { result &= handleExperimentConflict(experimentTracesMap, experimentToRename); } if (!unhandledTraces.isEmpty()) { result &= handleTracesConflict(unhandledTraces); } return result; }</code><technical_language>I this map is necessary. If TracePackageExperimentElement get list of traces it</technical_language>

Target:
private boolean checkForConflict() { TracePackageElement[] packageElements = (TracePackageElement[]) getElementViewer().getInput(); List<TracePackageExperimentElement> experimentElements = new ArrayList<>(); List<TracePackageTraceElement> traceElements = new ArrayList<>(); Map<TracePackageExperimentElement, List<TracePackageTraceElement>> experimentTracesMap = new HashMap<>(); List<TracePackageExperimentElement> experimentToRename = new ArrayList<>(); List<TracePackageTraceElement> unhandledTraces = new ArrayList<>(); for (TracePackageElement packageElement : packageElements) { TracePackageTraceElement traceElement = (TracePackageTraceElement) packageElement; if (AbstractTracePackageOperation.isFilesChecked(traceElement)) { if (traceElement instanceof TracePackageExperimentElement) { TracePackageExperimentElement experimentElement = (TracePackageExperimentElement) traceElement; experimentElements.add(experimentElement); if (experimentExists(experimentElement)) { experimentToRename.add(experimentElement); } } else { traceElements.add(traceElement); } } } for (TracePackageTraceElement traceElement : traceElements) { processTrace(experimentElements, traceElement, experimentTracesMap, unhandledTraces); } boolean result = true; if (!experimentTracesMap.isEmpty() || !experimentToRename.isEmpty()) { result &= handleExperimentConflict(experimentTracesMap, experimentToRename); } if (!unhandledTraces.isEmpty()) { result &= handleTracesConflict(unhandledTraces); } return result; }