Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMickael Istria2018-04-30 13:30:22 +0000
committerMickael Istria2018-04-30 13:30:22 +0000
commit162bca1da5a0d6a154a7a58aae5810f564f13fbf (patch)
tree0cd8149829e8e291afb7f82a7e0ab8ffde3706c7 /org.eclipse.search
parentcc244ba39902c89fe397d5f4369288a38c370910 (diff)
downloadeclipse.platform.text-162bca1da5a0d6a154a7a58aae5810f564f13fbf.tar.gz
eclipse.platform.text-162bca1da5a0d6a154a7a58aae5810f564f13fbf.tar.xz
eclipse.platform.text-162bca1da5a0d6a154a7a58aae5810f564f13fbf.zip
Improve some constructs for performance
Issues reported by SonarQube: * iterating on keySet() instead of entrySet() or values() * String += in a loop Change-Id: I3dec0e683305ab3382605168c0505d5ce2bcc35e Signed-off-by: Mickael Istria <mistria@redhat.com>
Diffstat (limited to 'org.eclipse.search')
-rw-r--r--org.eclipse.search/new search/org/eclipse/search2/internal/ui/text/EditorAccessHighlighter.java10
1 files changed, 4 insertions, 6 deletions
diff --git a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/text/EditorAccessHighlighter.java b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/text/EditorAccessHighlighter.java
index 406e46a3c8b..8f34edd43a5 100644
--- a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/text/EditorAccessHighlighter.java
+++ b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/text/EditorAccessHighlighter.java
@@ -132,9 +132,8 @@ public class EditorAccessHighlighter extends Highlighter {
}
}
- for (IAnnotationModel model : setsByAnnotationModel.keySet()) {
- Set<Annotation> set= setsByAnnotationModel.get(model);
- removeAnnotations(model, set);
+ for (Entry<IAnnotationModel, HashSet<Annotation>> entry : setsByAnnotationModel.entrySet()) {
+ removeAnnotations(entry.getKey(), entry.getValue());
}
}
@@ -144,9 +143,8 @@ public class EditorAccessHighlighter extends Highlighter {
IAnnotationModelExtension ame= (IAnnotationModelExtension) model;
ame.replaceAnnotations(new Annotation[0], annotationToPositionMap);
} else {
- for (Annotation element : annotationToPositionMap.keySet()) {
- Position p= annotationToPositionMap.get(element);
- model.addAnnotation(element, p);
+ for (Entry<Annotation, Position> entry : annotationToPositionMap.entrySet()) {
+ model.addAnnotation(entry.getKey(), entry.getValue());
}
}
}

Back to the top