Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Vogel2016-05-10 09:29:35 +0000
committerMickael Istria2017-02-02 18:23:49 +0000
commit987947306302e3c4960fc6f7d57b82e2a5a2435a (patch)
tree7bafdb64047edf0dea950efefefe8ff9a903c1aa /org.eclipse.ui.editors
parentfab00d8dab78d07b1caddd2a2c481c6c8e28510c (diff)
downloadeclipse.platform.text-987947306302e3c4960fc6f7d57b82e2a5a2435a.tar.gz
eclipse.platform.text-987947306302e3c4960fc6f7d57b82e2a5a2435a.tar.xz
eclipse.platform.text-987947306302e3c4960fc6f7d57b82e2a5a2435a.zip
Bug 493306 - Inefficient use of keySet iterator instead of entrySet
iterator in eclipse.text Change-Id: I5f43ac955ca602846b2f3680b2e63023e1c23368 Signed-off-by: Lars Vogel <Lars.Vogel@vogella.com>
Diffstat (limited to 'org.eclipse.ui.editors')
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/QuickDiffConfigurationBlock.java8
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/SelectResourcesBlock.java12
2 files changed, 11 insertions, 9 deletions
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/QuickDiffConfigurationBlock.java b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/QuickDiffConfigurationBlock.java
index 4531693e9..4da7156e7 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/QuickDiffConfigurationBlock.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/QuickDiffConfigurationBlock.java
@@ -16,6 +16,7 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import java.util.Map.Entry;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionEvent;
@@ -411,10 +412,9 @@ class QuickDiffConfigurationBlock implements IPreferenceConfigurationBlock {
}
private void initializeFields() {
- Iterator<Button> e= fCheckBoxes.keySet().iterator();
- while (e.hasNext()) {
- Button b= e.next();
- String key= fCheckBoxes.get(b);
+ for (Entry<Button, String> entry : fCheckBoxes.entrySet()) {
+ Button b = entry.getKey();
+ String key= entry.getValue();
b.setSelection(fStore.getBoolean(key));
}
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/SelectResourcesBlock.java b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/SelectResourcesBlock.java
index b44c54bbd..1a928e905 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/SelectResourcesBlock.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/SelectResourcesBlock.java
@@ -17,6 +17,7 @@ import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import java.util.Map.Entry;
import java.util.Set;
import org.eclipse.swt.SWT;
@@ -864,14 +865,15 @@ class SelectResourcesBlock implements ICheckStateListener, ISelectionChangedList
Set<Object> selectedNodes= new HashSet<>();
checkedStateStore= new HashMap<>();
- //Update the store before the hierarchy to prevent updating parents
+ // Update the store before the hierarchy to prevent updating parents
// before all of the children are done
- Iterator<IContainer> keyIterator= items.keySet().iterator();
- while (keyIterator.hasNext()) {
- Object key= keyIterator.next();
+
+ for (Entry<IContainer, List<Object>> entry : items.entrySet()) {
+ Object key = entry.getKey();
primeHierarchyForSelection(key, selectedNodes);
- checkedStateStore.put(key, items.get(key));
+ checkedStateStore.put(key, entry.getValue());
}
+
// Update the checked tree items. Since each tree item has a selected
// item, all the tree items will be gray checked.

Back to the top