Merge pull request #215 from sba1/array-list-performance-fix

Use max() instead of min() when enlarging the array.
This commit is contained in:
Alexey Andreev 2016-08-18 21:12:38 +03:00 committed by GitHub
commit 49fda4ec4e

View File

@ -53,7 +53,7 @@ public class TArrayList<E> extends TAbstractList<E> implements TCloneable, TSeri
public void ensureCapacity(int minCapacity) {
if (array.length < minCapacity) {
array = TArrays.copyOf(array, array.length + TMath.min(5, array.length / 2));
array = TArrays.copyOf(array, array.length + TMath.max(5, array.length / 2));
}
}