Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Vogel2016-05-10 05:29:35 -0400
committerMickael Istria2017-02-02 13:23:49 -0500
commit987947306302e3c4960fc6f7d57b82e2a5a2435a (patch)
tree7bafdb64047edf0dea950efefefe8ff9a903c1aa /org.eclipse.text
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.text')
-rw-r--r--org.eclipse.text/src/org/eclipse/jface/text/AbstractDocument.java9
-rw-r--r--org.eclipse.text/src/org/eclipse/text/edits/MoveSourceEdit.java8
2 files changed, 9 insertions, 8 deletions
diff --git a/org.eclipse.text/src/org/eclipse/jface/text/AbstractDocument.java b/org.eclipse.text/src/org/eclipse/jface/text/AbstractDocument.java
index 45e6e9ccc..f0f24411a 100644
--- a/org.eclipse.text/src/org/eclipse/jface/text/AbstractDocument.java
+++ b/org.eclipse.text/src/org/eclipse/jface/text/AbstractDocument.java
@@ -18,6 +18,7 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import java.util.Map.Entry;
import java.util.regex.PatternSyntaxException;
import org.eclipse.core.runtime.Assert;
@@ -655,10 +656,10 @@ public abstract class AbstractDocument implements IDocument, IDocumentExtension,
if (fDocumentPartitioners != null) {
fDocumentPartitioningChangedEvent= new DocumentPartitioningChangedEvent(this);
- Iterator<String> e= fDocumentPartitioners.keySet().iterator();
- while (e.hasNext()) {
- String partitioning= e.next();
- IDocumentPartitioner partitioner= fDocumentPartitioners.get(partitioning);
+ for (Entry<String, IDocumentPartitioner> entry : fDocumentPartitioners.entrySet()) {
+
+ String partitioning= entry.getKey();
+ IDocumentPartitioner partitioner= entry.getValue();
if (partitioner instanceof IDocumentPartitionerExtension3) {
IDocumentPartitionerExtension3 extension= (IDocumentPartitionerExtension3) partitioner;
diff --git a/org.eclipse.text/src/org/eclipse/text/edits/MoveSourceEdit.java b/org.eclipse.text/src/org/eclipse/text/edits/MoveSourceEdit.java
index f297f2c0f..b02307032 100644
--- a/org.eclipse.text/src/org/eclipse/text/edits/MoveSourceEdit.java
+++ b/org.eclipse.text/src/org/eclipse/text/edits/MoveSourceEdit.java
@@ -13,9 +13,9 @@ package org.eclipse.text.edits;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
-import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import java.util.Map.Entry;
import org.eclipse.core.runtime.Assert;
@@ -420,9 +420,9 @@ public final class MoveSourceEdit extends TextEdit {
}
private static void restorePositions(Map<TextEdit, TextEdit> editMap) {
- for (Iterator<TextEdit> iter= editMap.keySet().iterator(); iter.hasNext();) {
- TextEdit marker= iter.next();
- TextEdit edit= editMap.get(marker);
+ for (Entry<TextEdit, TextEdit> entry: editMap.entrySet()) {
+ TextEdit marker = entry.getKey();
+ TextEdit edit= entry.getValue();
if (marker.isDeleted()) {
edit.markAsDeleted();
} else {

Back to the top