Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Keppler2018-08-06 12:10:12 +0000
committerThomas Wolf2018-08-13 16:35:35 +0000
commit7e54c44063ed9769a9d3c443799c52d4b2989cfd (patch)
treef860a4245b256b885b031173130fea59852fc127 /org.eclipse.egit.mylyn.ui
parentdcc38081a23dedcc855b0abfa6f14253b93a5626 (diff)
downloadegit-7e54c44063ed9769a9d3c443799c52d4b2989cfd.tar.gz
egit-7e54c44063ed9769a9d3c443799c52d4b2989cfd.tar.xz
egit-7e54c44063ed9769a9d3c443799c52d4b2989cfd.zip
refactor: simplify collection.toArray()
On recent VMs, collection.toArray(new T[0]) is faster than collection.toArray(new T[collection.size()]). Since it is also more readable, it should now be the preferred way of collection to array conversion. https://shipilev.net/blog/2016/arrays-wisdom-ancients/ Change-Id: If0c3202aa3ebb2d4e4ea68da8fe431cd8f363826 Signed-off-by: Michael Keppler <Michael.Keppler@gmx.de>
Diffstat (limited to 'org.eclipse.egit.mylyn.ui')
-rw-r--r--org.eclipse.egit.mylyn.ui/src/org/eclipse/egit/internal/mylyn/ui/CommitHyperlinkDetector.java2
1 files changed, 1 insertions, 1 deletions
diff --git a/org.eclipse.egit.mylyn.ui/src/org/eclipse/egit/internal/mylyn/ui/CommitHyperlinkDetector.java b/org.eclipse.egit.mylyn.ui/src/org/eclipse/egit/internal/mylyn/ui/CommitHyperlinkDetector.java
index bdde073447..5e86144458 100644
--- a/org.eclipse.egit.mylyn.ui/src/org/eclipse/egit/internal/mylyn/ui/CommitHyperlinkDetector.java
+++ b/org.eclipse.egit.mylyn.ui/src/org/eclipse/egit/internal/mylyn/ui/CommitHyperlinkDetector.java
@@ -219,7 +219,7 @@ public class CommitHyperlinkDetector extends AbstractHyperlinkDetector {
if (hyperlinks.isEmpty()) {
return null;
}
- return hyperlinks.toArray(new IHyperlink[hyperlinks.size()]);
+ return hyperlinks.toArray(new IHyperlink[0]);
}
private List<IHyperlink> detectHyperlinks(ITextViewer textViewer,

Back to the top