Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Vogel2020-01-13 15:49:52 +0000
committerLars Vogel2020-01-13 18:54:11 +0000
commit9c39c6916e419f47717f76c025e1b2f2cd1f72b6 (patch)
treea63b0cfaff2a5508f8e1bab394c7adc0a86a9317 /org.eclipse.debug.ui/ui/org
parentcf7a4867309401b9b4bb97fd4ba769a113696aa7 (diff)
downloadeclipse.platform.debug-9c39c6916e419f47717f76c025e1b2f2cd1f72b6.tar.gz
eclipse.platform.debug-9c39c6916e419f47717f76c025e1b2f2cd1f72b6.tar.xz
eclipse.platform.debug-9c39c6916e419f47717f76c025e1b2f2cd1f72b6.zip
Iterate over Map.entrySet instead of Map.keySet and value searchI20200114-1805
Faster than first getting the keys and afterwards reading the value. Done with Autorefactor https://github.com/JnRouvignac/AutoRefactor/ batch conversion using the iterate over Map.entrySet instead of Map.keySet and value search Change-Id: I438796d7ce3abd35c5a8922559c582ef8685ed08 Signed-off-by: Lars Vogel <Lars.Vogel@vogella.com>
Diffstat (limited to 'org.eclipse.debug.ui/ui/org')
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/DebugWindowContextService.java10
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/breakpoints/EmbeddedBreakpointsViewer.java5
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/ExpressionContentProvider.java15
3 files changed, 18 insertions, 12 deletions
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/DebugWindowContextService.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/DebugWindowContextService.java
index 7b99a071b..780901061 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/DebugWindowContextService.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/DebugWindowContextService.java
@@ -250,7 +250,8 @@ public class DebugWindowContextService implements IDebugContextService, IPartLis
}
}
- outer: for (String listenerPartId : fListenersByPartId.keySet()) {
+ outer: for (Map.Entry<String, ListenerList<IDebugContextListener>> entry : fListenersByPartId.entrySet()) {
+ String listenerPartId = entry.getKey();
for (IDebugContextProvider provider : fProviders) {
String providerPartId = getCombinedPartId(provider.getPart());
if ((listenerPartId == null && providerPartId == null) ||
@@ -259,7 +260,7 @@ public class DebugWindowContextService implements IDebugContextService, IPartLis
continue outer;
}
}
- ListenerList<IDebugContextListener> listenersForPart = fListenersByPartId.get(listenerPartId);
+ ListenerList<IDebugContextListener> listenersForPart = entry.getValue();
if (listenersForPart != null) {
for (IDebugContextListener iDebugContextListener : listenersForPart) {
// no effect if listener already present
@@ -283,14 +284,15 @@ public class DebugWindowContextService implements IDebugContextService, IPartLis
retVal = new ListenerList<>();
}
- outer: for (String listenerPartId : fPostListenersByPartId.keySet()) {
+ outer: for (Map.Entry<String, ListenerList<IDebugContextListener>> entry : fPostListenersByPartId.entrySet()) {
+ String listenerPartId = entry.getKey();
for (IDebugContextProvider provider : fProviders) {
String providerPartId = getCombinedPartId(provider.getPart());
if ((listenerPartId == null && providerPartId == null) || (listenerPartId != null && listenerPartId.equals(providerPartId))) {
continue outer;
}
}
- ListenerList<IDebugContextListener> listenersForPart = fPostListenersByPartId.get(listenerPartId);
+ ListenerList<IDebugContextListener> listenersForPart = entry.getValue();
if (listenersForPart != null) {
for (IDebugContextListener iDebugContextListener : listenersForPart) {
// no effect if listener already present
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/breakpoints/EmbeddedBreakpointsViewer.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/breakpoints/EmbeddedBreakpointsViewer.java
index 3c277383d..4e21e8115 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/breakpoints/EmbeddedBreakpointsViewer.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/breakpoints/EmbeddedBreakpointsViewer.java
@@ -122,8 +122,9 @@ public class EmbeddedBreakpointsViewer {
}
if(map != null) {
IDebugModelPresentation newpres = labelprovider.getPresentation();
- for (String key : map.keySet()) {
- newpres.setAttribute(key, map.get(key));
+ for (Map.Entry<String, Object> entry : map.entrySet()) {
+ String key = entry.getKey();
+ newpres.setAttribute(key, entry.getValue());
}
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/ExpressionContentProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/ExpressionContentProvider.java
index 51813e8b4..11e379da4 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/ExpressionContentProvider.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/ExpressionContentProvider.java
@@ -94,8 +94,9 @@ public class ExpressionContentProvider extends VariableContentProvider {
findDelegates(delegateMap, notDelegated, updates);
// Batch the updates and send them to the delegates
- for (IElementContentProvider delegate : delegateMap.keySet()) {
- List<IViewerUpdate> updateList = delegateMap.get(delegate);
+ for (Map.Entry<IElementContentProvider, List<IViewerUpdate>> entry : delegateMap.entrySet()) {
+ IElementContentProvider delegate = entry.getKey();
+ List<IViewerUpdate> updateList = entry.getValue();
delegate.update(updateList.toArray(new IChildrenCountUpdate[updateList.size()]));
}
if (notDelegated.size() > 0){
@@ -111,8 +112,9 @@ public class ExpressionContentProvider extends VariableContentProvider {
findDelegates(delegateMap, notDelegated, updates);
// Batch the updates and send them to the delegates
- for (IElementContentProvider delegate : delegateMap.keySet()) {
- List<IViewerUpdate> updateList = delegateMap.get(delegate);
+ for (Map.Entry<IElementContentProvider, List<IViewerUpdate>> entry : delegateMap.entrySet()) {
+ IElementContentProvider delegate = entry.getKey();
+ List<IViewerUpdate> updateList = entry.getValue();
delegate.update(updateList.toArray(new IHasChildrenUpdate[updateList.size()]));
}
if (notDelegated.size() > 0){
@@ -128,8 +130,9 @@ public class ExpressionContentProvider extends VariableContentProvider {
findDelegates(delegateMap, notDelegated, updates);
// Batch the updates and send them to the delegates
- for (IElementContentProvider delegate : delegateMap.keySet()) {
- List<IViewerUpdate> updateList = delegateMap.get(delegate);
+ for (Map.Entry<IElementContentProvider, List<IViewerUpdate>> entry : delegateMap.entrySet()) {
+ IElementContentProvider delegate = entry.getKey();
+ List<IViewerUpdate> updateList = entry.getValue();
delegate.update(updateList.toArray(new IChildrenUpdate[updateList.size()]));
}
if (notDelegated.size() > 0){

Back to the top