From 71140135fa3338259e57494e694ebd429b49bb27 Mon Sep 17 00:00:00 2001 From: Ivan Hetman Date: Mon, 26 Oct 2020 12:02:13 +0200 Subject: [PATCH] Add missing toArray method from JDK 11 (#531) --- .../main/java/org/teavm/classlib/java/util/TCollection.java | 5 +++++ 1 file changed, 5 insertions(+) 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);