Browse Source

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 <spearce@spearce.org>
stable-0.10
Shawn O. Pearce 14 years ago
parent
commit
9bcf391355
  1. 6
      org.eclipse.jgit/src/org/eclipse/jgit/diff/EditList.java

6
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.AbstractList;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection;
/** Specialized list of {@link Edit}s in a document. */ /** Specialized list of {@link Edit}s in a document. */
public class EditList extends AbstractList<Edit> { public class EditList extends AbstractList<Edit> {
@ -99,6 +100,11 @@ public class EditList extends AbstractList<Edit> {
container.add(index, element); container.add(index, element);
} }
@Override
public boolean addAll(Collection<? extends Edit> c) {
return container.addAll(c);
}
@Override @Override
public Edit remove(final int index) { public Edit remove(final int index) {
return container.remove(index); return container.remove(index);

Loading…
Cancel
Save