From 6848984a10514f7493b8751f5380bad4c52fdab9 Mon Sep 17 00:00:00 2001 From: Alexey Andreev Date: Tue, 24 Oct 2017 23:06:43 +0300 Subject: [PATCH] Provide independent implementation for ArrayList.add(E). To improve performance. Also, see #310 --- .../java/org/teavm/classlib/java/util/TArrayList.java | 8 ++++++++ 1 file changed, 8 insertions(+) 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 614f35921..094801130 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 @@ -84,6 +84,14 @@ public class TArrayList extends TAbstractList implements TCloneable, TSeri return old; } + @Override + public boolean add(E element) { + ensureCapacity(size + 1); + array[size++] = element; + ++modCount; + return true; + } + @Override public void add(int index, E element) { checkIndexForAdd(index);