mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2025-01-03 05:44:10 -08:00
Merge pull request #215 from sba1/array-list-performance-fix
Use max() instead of min() when enlarging the array.
This commit is contained in:
commit
49fda4ec4e
|
@ -53,7 +53,7 @@ public class TArrayList<E> extends TAbstractList<E> implements TCloneable, TSeri
|
||||||
|
|
||||||
public void ensureCapacity(int minCapacity) {
|
public void ensureCapacity(int minCapacity) {
|
||||||
if (array.length < 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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user