summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test/src/org/eclipse
diff options
context:
space:
mode:
authorMichael Keppler <Michael.Keppler@gmx.de>2018-08-06 14:11:26 +0200
committerJonathan Nieder <jrn@google.com>2018-08-23 01:34:39 -0400
commit2fc00af44e5658cf34200ad20d777a75333a0564 (patch)
tree4176d6c478946dee29d54fac9d6eb2f91bdbb613 /org.eclipse.jgit.test/src/org/eclipse
parent7058493fea6992c914a200b64f48b0b61f192ac0 (diff)
downloadjgit-2fc00af44e5658cf34200ad20d777a75333a0564.tar.gz
jgit-2fc00af44e5658cf34200ad20d777a75333a0564.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: I80388532fb4b2b0663ee1fe8baa94f5df55c8442 Signed-off-by: Michael Keppler <Michael.Keppler@gmx.de>
Diffstat (limited to 'org.eclipse.jgit.test/src/org/eclipse')
-rw-r--r--org.eclipse.jgit.test/src/org/eclipse/jgit/events/ChangeRecorder.java4
1 files changed, 2 insertions, 2 deletions
diff --git a/org.eclipse.jgit.test/src/org/eclipse/jgit/events/ChangeRecorder.java b/org.eclipse.jgit.test/src/org/eclipse/jgit/events/ChangeRecorder.java
index c5582a8601..228df35c76 100644
--- a/org.eclipse.jgit.test/src/org/eclipse/jgit/events/ChangeRecorder.java
+++ b/org.eclipse.jgit.test/src/org/eclipse/jgit/events/ChangeRecorder.java
@@ -74,11 +74,11 @@ public class ChangeRecorder implements WorkingTreeModifiedListener {
}
private String[] getModified() {
- return modified.toArray(new String[modified.size()]);
+ return modified.toArray(new String[0]);
}
private String[] getDeleted() {
- return deleted.toArray(new String[deleted.size()]);
+ return deleted.toArray(new String[0]);
}
private void reset() {