Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Keppler2019-07-17 14:17:01 -0400
committerMichael Keppler2019-09-18 02:29:03 -0400
commit7040c93714187a5721ee8831ef0d12f6c4e16bbf (patch)
treec2c3489ae42c5fecd65b93ce56b3afc54d276387
parent562d5c52cc5ac97efea57ec0f30c23e89fcfaa24 (diff)
downloadegit-github-7040c93714187a5721ee8831ef0d12f6c4e16bbf.tar.gz
egit-github-7040c93714187a5721ee8831ef0d12f6c4e16bbf.tar.xz
egit-github-7040c93714187a5721ee8831ef0d12f6c4e16bbf.zip
Simplify collection.toArray() calls
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/ Regex used for search: (?s)\Q.toArray(\E\s*new\s+\w+\Q[\E(?!0) Change-Id: I8c20a5b01e2bba4a47e24c6a9bb37e81dd438bd1 Signed-off-by: Michael Keppler <Michael.Keppler@gmx.de>
-rw-r--r--org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/internal/github/ui/pr/PullRequestAdapter.java7
1 files changed, 3 insertions, 4 deletions
diff --git a/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/internal/github/ui/pr/PullRequestAdapter.java b/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/internal/github/ui/pr/PullRequestAdapter.java
index c2a64015..81fa8fee 100644
--- a/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/internal/github/ui/pr/PullRequestAdapter.java
+++ b/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/internal/github/ui/pr/PullRequestAdapter.java
@@ -28,17 +28,16 @@ public class PullRequestAdapter extends WorkbenchAdapter {
/**
* Create pull request adapter
- *
+ *
* @param request
*/
public PullRequestAdapter(PullRequestComposite request) {
- List<PullRequestCommitAdapter> prCommits = new ArrayList<PullRequestCommitAdapter>();
+ List<PullRequestCommitAdapter> prCommits = new ArrayList<>();
List<RepositoryCommit> requestCommits = request.getCommits();
if (requestCommits != null)
for (RepositoryCommit commit : requestCommits)
prCommits.add(new PullRequestCommitAdapter(commit));
- commits = prCommits.toArray(new PullRequestCommitAdapter[prCommits
- .size()]);
+ commits = prCommits.toArray(new PullRequestCommitAdapter[0]);
}
@Override

Back to the top