mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-22 16:14:10 -08:00
classlib: minor exceptions fix for lists (#819)
This commit is contained in:
parent
55d3adb7ae
commit
0b2d1428fb
|
@ -70,7 +70,7 @@ public abstract class TAbstractList<E> extends TAbstractCollection<E> implements
|
||||||
@Override
|
@Override
|
||||||
public boolean addAll(int index, TCollection<? extends E> c) {
|
public boolean addAll(int index, TCollection<? extends E> c) {
|
||||||
if (index < 0 || index > size()) {
|
if (index < 0 || index > size()) {
|
||||||
throw new TIllegalArgumentException();
|
throw new TIndexOutOfBoundsException();
|
||||||
}
|
}
|
||||||
if (c.isEmpty()) {
|
if (c.isEmpty()) {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -34,6 +34,9 @@ public class TArrayList<E> extends TAbstractList<E> implements TCloneable, TSeri
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public TArrayList(int initialCapacity) {
|
public TArrayList(int initialCapacity) {
|
||||||
|
if (initialCapacity < 0) {
|
||||||
|
throw new IllegalArgumentException();
|
||||||
|
}
|
||||||
array = (E[]) new Object[initialCapacity];
|
array = (E[]) new Object[initialCapacity];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user