diff --git a/classlib/src/main/java/org/teavm/classlib/java/util/TCollection.java b/classlib/src/main/java/org/teavm/classlib/java/util/TCollection.java index c4600a3b0..0b6979c88 100644 --- a/classlib/src/main/java/org/teavm/classlib/java/util/TCollection.java +++ b/classlib/src/main/java/org/teavm/classlib/java/util/TCollection.java @@ -16,6 +16,7 @@ package org.teavm.classlib.java.util; import java.util.Spliterator; +import java.util.function.IntFunction; import java.util.function.Predicate; import org.teavm.classlib.java.lang.TIterable; import org.teavm.classlib.java.util.stream.TStream; @@ -33,6 +34,10 @@ public interface TCollection extends TIterable { T[] toArray(T[] a); + default T[] toArray(IntFunction gen) { + return toArray(gen.apply(0)); + } + boolean add(E e); boolean remove(Object o);