From 9bcf391355ce8772e934a8e865e148525f8a0cbd Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Tue, 21 Sep 2010 08:23:12 -0700 Subject: [PATCH] Micro-optimize EditList.addAll Pass through the addAll request to our underlying ArrayList. This way the underlying ArrayList grows no more than once during the call, which may be important if the list was originally allocated at the default size of 16, but 64 Edits are being added. Change-Id: I31c3261e895766f82c3c832b251a09f6e37e8860 Signed-off-by: Shawn O. Pearce --- org.eclipse.jgit/src/org/eclipse/jgit/diff/EditList.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/diff/EditList.java b/org.eclipse.jgit/src/org/eclipse/jgit/diff/EditList.java index a8088207f..445ff7afe 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/diff/EditList.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/diff/EditList.java @@ -45,6 +45,7 @@ package org.eclipse.jgit.diff; import java.util.AbstractList; import java.util.ArrayList; +import java.util.Collection; /** Specialized list of {@link Edit}s in a document. */ public class EditList extends AbstractList { @@ -99,6 +100,11 @@ public class EditList extends AbstractList { container.add(index, element); } + @Override + public boolean addAll(Collection c) { + return container.addAll(c); + } + @Override public Edit remove(final int index) { return container.remove(index);