mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
[245749] More efficient removal by using iterator.remove()
This commit is contained in:
parent
88969aa247
commit
8805635914
1 changed files with 6 additions and 17 deletions
|
@ -12,12 +12,10 @@
|
||||||
package org.eclipse.dd.mi.service.command;
|
package org.eclipse.dd.mi.service.command;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import org.eclipse.dd.dsf.debug.service.IProcesses.IProcessDMContext;
|
import org.eclipse.dd.dsf.debug.service.IProcesses.IProcessDMContext;
|
||||||
import org.eclipse.dd.dsf.debug.service.IProcesses.IThreadDMContext;
|
import org.eclipse.dd.dsf.debug.service.IProcesses.IThreadDMContext;
|
||||||
|
@ -245,21 +243,12 @@ public class MIRunControlEventProcessor_7_0
|
||||||
// When detaching from a group, we won't have received any thread-exited event
|
// When detaching from a group, we won't have received any thread-exited event
|
||||||
// but we don't want to keep those entries.
|
// but we don't want to keep those entries.
|
||||||
if (fThreadToGroupMap.containsValue(groupId)) {
|
if (fThreadToGroupMap.containsValue(groupId)) {
|
||||||
Set<String> setToRemove = new HashSet<String>();
|
Iterator<Map.Entry<String, String>> iterator = fThreadToGroupMap.entrySet().iterator();
|
||||||
|
while (iterator.hasNext()){
|
||||||
Iterator<Map.Entry<String, String>> iterator1 = fThreadToGroupMap.entrySet().iterator();
|
if (iterator.next().getValue().equals(groupId)) {
|
||||||
while (iterator1.hasNext()){
|
iterator.remove();
|
||||||
Map.Entry<String, String> pairs = iterator1.next();
|
|
||||||
if (pairs.getValue().equals(groupId)) {
|
|
||||||
setToRemove.add(pairs.getKey());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Iterator<String> iterator2 = setToRemove.iterator();
|
|
||||||
while (iterator2.hasNext()){
|
|
||||||
String key = iterator2.next();
|
|
||||||
fThreadToGroupMap.remove(key);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -327,9 +316,9 @@ public class MIRunControlEventProcessor_7_0
|
||||||
} else if ("function-finished".equals(reason)) { //$NON-NLS-1$
|
} else if ("function-finished".equals(reason)) { //$NON-NLS-1$
|
||||||
event = MIFunctionFinishedEvent.parse(execDmc, exec.getToken(), exec.getMIResults());
|
event = MIFunctionFinishedEvent.parse(execDmc, exec.getToken(), exec.getMIResults());
|
||||||
} else if ("exited-normally".equals(reason) || "exited".equals(reason)) { //$NON-NLS-1$ //$NON-NLS-2$
|
} else if ("exited-normally".equals(reason) || "exited".equals(reason)) { //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
event = MIInferiorExitEvent.parse(fCommandControl.getControlDMContext(), exec.getToken(), exec.getMIResults());
|
event = MIInferiorExitEvent.parse(fCommandControl.getContext(), exec.getToken(), exec.getMIResults());
|
||||||
} else if ("exited-signalled".equals(reason)) { //$NON-NLS-1$
|
} else if ("exited-signalled".equals(reason)) { //$NON-NLS-1$
|
||||||
event = MIInferiorSignalExitEvent.parse(fCommandControl.getControlDMContext(), exec.getToken(), exec.getMIResults());
|
event = MIInferiorSignalExitEvent.parse(fCommandControl.getContext(), exec.getToken(), exec.getMIResults());
|
||||||
} else if (STOPPED_REASON.equals(reason)) {
|
} else if (STOPPED_REASON.equals(reason)) {
|
||||||
event = MIStoppedEvent.parse(execDmc, exec.getToken(), exec.getMIResults());
|
event = MIStoppedEvent.parse(execDmc, exec.getToken(), exec.getMIResults());
|
||||||
} else if (RUNNING_REASON.equals(reason)) {
|
} else if (RUNNING_REASON.equals(reason)) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue