Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Vogel2020-02-07 08:56:19 +0000
committerLars Vogel2020-02-11 12:27:35 +0000
commit4c9a7526886c2c5ebe32be6ba5e02a3d02cdbd2c (patch)
tree26f9ad862df41e7d6d0e8f7cb28ef613c717b3e8
parentc3c0ef751d02e84430240c95f70b7887d60a5f7f (diff)
downloadeclipse.platform.text-4c9a7526886c2c5ebe32be6ba5e02a3d02cdbd2c.tar.gz
eclipse.platform.text-4c9a7526886c2c5ebe32be6ba5e02a3d02cdbd2c.tar.xz
eclipse.platform.text-4c9a7526886c2c5ebe32be6ba5e02a3d02cdbd2c.zip
Use map method directly if possibleI20200212-1420I20200212-0910I20200211-1800
JDT provides a new cleanup which allows to transform code to call methods directly on map instead of accessing the values or the keys before calling the same method. Saves code which we have to read and might be slightly faster. Change-Id: I3673494ffa912c591e617672e254d29885f29772 Signed-off-by: Lars Vogel <Lars.Vogel@vogella.com>
-rw-r--r--org.eclipse.search/new search/org/eclipse/search2/internal/ui/text/EditorAccessHighlighter.java2
-rw-r--r--org.eclipse.search/new search/org/eclipse/search2/internal/ui/text/MarkerHighlighter.java2
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/text/ReplaceRefactoring.java2
-rw-r--r--org.eclipse.ui.genericeditor.examples/src/org/eclipse/ui/genericeditor/examples/dotproject/HighlightStrategy.java2
-rw-r--r--org.eclipse.ui.genericeditor/src/org/eclipse/ui/internal/genericeditor/DefaultWordHighlightStrategy.java2
5 files changed, 5 insertions, 5 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 177f0fd66..06e90816d 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
@@ -191,7 +191,7 @@ public class EditorAccessHighlighter extends Highlighter {
}
if (document != null && document.equals(textBuffer.getDocument())) {
- Match[] matches= new Match[fMatchesToAnnotations.keySet().size()];
+ Match[] matches= new Match[fMatchesToAnnotations.size()];
fMatchesToAnnotations.keySet().toArray(matches);
removeAll();
addHighlights(matches);
diff --git a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/text/MarkerHighlighter.java b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/text/MarkerHighlighter.java
index bda8a0b83..a09950514 100644
--- a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/text/MarkerHighlighter.java
+++ b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/text/MarkerHighlighter.java
@@ -115,7 +115,7 @@ public class MarkerHighlighter extends Highlighter {
protected void handleContentReplaced(IFileBuffer buffer) {
if (!buffer.getLocation().equals(fFile.getFullPath()))
return;
- Match[] matches= new Match[fMatchesToAnnotations.keySet().size()];
+ Match[] matches= new Match[fMatchesToAnnotations.size()];
fMatchesToAnnotations.keySet().toArray(matches);
removeAll();
addHighlights(matches);
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/text/ReplaceRefactoring.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/text/ReplaceRefactoring.java
index ad1ab219f..de099fdac 100644
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/text/ReplaceRefactoring.java
+++ b/org.eclipse.search/search/org/eclipse/search/internal/ui/text/ReplaceRefactoring.java
@@ -260,7 +260,7 @@ public class ReplaceRefactoring extends Refactoring {
}
public int getNumberOfFiles() {
- return fMatches.keySet().size();
+ return fMatches.size();
}
public int getNumberOfMatches() {
diff --git a/org.eclipse.ui.genericeditor.examples/src/org/eclipse/ui/genericeditor/examples/dotproject/HighlightStrategy.java b/org.eclipse.ui.genericeditor.examples/src/org/eclipse/ui/genericeditor/examples/dotproject/HighlightStrategy.java
index 3d43e9964..46922c78d 100644
--- a/org.eclipse.ui.genericeditor.examples/src/org/eclipse/ui/genericeditor/examples/dotproject/HighlightStrategy.java
+++ b/org.eclipse.ui.genericeditor.examples/src/org/eclipse/ui/genericeditor/examples/dotproject/HighlightStrategy.java
@@ -105,7 +105,7 @@ public class HighlightStrategy implements IReconcilingStrategy, IReconcilingStra
annotationModel.addAnnotation(mapEntry.getKey(), mapEntry.getValue());
}
}
- fOccurrenceAnnotations = annotationMap.keySet().toArray(new Annotation[annotationMap.keySet().size()]);
+ fOccurrenceAnnotations = annotationMap.keySet().toArray(new Annotation[annotationMap.size()]);
}
}
diff --git a/org.eclipse.ui.genericeditor/src/org/eclipse/ui/internal/genericeditor/DefaultWordHighlightStrategy.java b/org.eclipse.ui.genericeditor/src/org/eclipse/ui/internal/genericeditor/DefaultWordHighlightStrategy.java
index f7385d781..517422c32 100644
--- a/org.eclipse.ui.genericeditor/src/org/eclipse/ui/internal/genericeditor/DefaultWordHighlightStrategy.java
+++ b/org.eclipse.ui.genericeditor/src/org/eclipse/ui/internal/genericeditor/DefaultWordHighlightStrategy.java
@@ -117,7 +117,7 @@ public class DefaultWordHighlightStrategy implements IReconcilingStrategy, IReco
annotationModel.addAnnotation(mapEntry.getKey(), mapEntry.getValue());
}
}
- fOccurrenceAnnotations = annotationMap.keySet().toArray(new Annotation[annotationMap.keySet().size()]);
+ fOccurrenceAnnotations = annotationMap.keySet().toArray(new Annotation[annotationMap.size()]);
}
} else {
fOccurrenceAnnotations = null;

Back to the top