From 2fc00af44e5658cf34200ad20d777a75333a0564 Mon Sep 17 00:00:00 2001 From: Michael Keppler Date: Mon, 6 Aug 2018 14:11:26 +0200 Subject: 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 --- org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/LfsPrePushHook.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'org.eclipse.jgit.lfs/src/org') diff --git a/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/LfsPrePushHook.java b/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/LfsPrePushHook.java index de4449f5e3..a20c1d96fe 100644 --- a/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/LfsPrePushHook.java +++ b/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/LfsPrePushHook.java @@ -201,7 +201,7 @@ public class LfsPrePushHook extends PrePushHook { private Map requestBatchUpload(HttpConnection api, Set toPush) throws IOException { - LfsPointer[] res = toPush.toArray(new LfsPointer[toPush.size()]); + LfsPointer[] res = toPush.toArray(new LfsPointer[0]); Map oidStr2ptr = new HashMap<>(); for (LfsPointer p : res) { oidStr2ptr.put(p.getOid().name(), p); -- cgit v1.2.3