diff --git a/classlib/src/main/java/org/teavm/classlib/java/util/TArrayList.java b/classlib/src/main/java/org/teavm/classlib/java/util/TArrayList.java index f5b31f338..22728d3b7 100644 --- a/classlib/src/main/java/org/teavm/classlib/java/util/TArrayList.java +++ b/classlib/src/main/java/org/teavm/classlib/java/util/TArrayList.java @@ -21,7 +21,7 @@ import org.teavm.classlib.java.lang.*; import org.teavm.classlib.java.util.function.TUnaryOperator; import org.teavm.interop.Rename; -public class TArrayList extends TAbstractList implements TCloneable, TSerializable { +public class TArrayList extends TAbstractList implements TCloneable, TSerializable, TRandomAccess { private E[] array; private int size; diff --git a/classlib/src/main/java/org/teavm/classlib/java/util/TCollections.java b/classlib/src/main/java/org/teavm/classlib/java/util/TCollections.java index 47045d271..a03427399 100644 --- a/classlib/src/main/java/org/teavm/classlib/java/util/TCollections.java +++ b/classlib/src/main/java/org/teavm/classlib/java/util/TCollections.java @@ -224,7 +224,7 @@ public class TCollections extends TObject { reverse(list, 0, list.size()); } else { TList randomAccess = new TArrayList<>(list); - reverse(list, 0, list.size()); + reverse(randomAccess, 0, randomAccess.size()); list.clear(); ((TList) list).addAll(randomAccess); }