mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-22 16:14:10 -08:00
Fix Collections.reverse for non-random access lists. Make ArrayList random access.
This commit is contained in:
parent
65c92aab1f
commit
5035c58533
|
@ -21,7 +21,7 @@ import org.teavm.classlib.java.lang.*;
|
||||||
import org.teavm.classlib.java.util.function.TUnaryOperator;
|
import org.teavm.classlib.java.util.function.TUnaryOperator;
|
||||||
import org.teavm.interop.Rename;
|
import org.teavm.interop.Rename;
|
||||||
|
|
||||||
public class TArrayList<E> extends TAbstractList<E> implements TCloneable, TSerializable {
|
public class TArrayList<E> extends TAbstractList<E> implements TCloneable, TSerializable, TRandomAccess {
|
||||||
private E[] array;
|
private E[] array;
|
||||||
private int size;
|
private int size;
|
||||||
|
|
||||||
|
|
|
@ -224,7 +224,7 @@ public class TCollections extends TObject {
|
||||||
reverse(list, 0, list.size());
|
reverse(list, 0, list.size());
|
||||||
} else {
|
} else {
|
||||||
TList<Object> randomAccess = new TArrayList<>(list);
|
TList<Object> randomAccess = new TArrayList<>(list);
|
||||||
reverse(list, 0, list.size());
|
reverse(randomAccess, 0, randomAccess.size());
|
||||||
list.clear();
|
list.clear();
|
||||||
((TList<Object>) list).addAll(randomAccess);
|
((TList<Object>) list).addAll(randomAccess);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user