From d18d50a8234edf76299dcbb1cd72f042b25ba3ef Mon Sep 17 00:00:00 2001 From: Dylan Date: Mon, 1 Apr 2019 17:24:01 -0400 Subject: [PATCH] Add missing forEach to TIterable --- .../main/java/org/teavm/classlib/java/lang/TIterable.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/classlib/src/main/java/org/teavm/classlib/java/lang/TIterable.java b/classlib/src/main/java/org/teavm/classlib/java/lang/TIterable.java index 96df87610..59d5c9977 100644 --- a/classlib/src/main/java/org/teavm/classlib/java/lang/TIterable.java +++ b/classlib/src/main/java/org/teavm/classlib/java/lang/TIterable.java @@ -22,6 +22,12 @@ import org.teavm.classlib.java.util.TSpliterator; public interface TIterable { TIterator iterator(); + default void forEach(Consumer action) { + for (TIterator itr = iterator(); itr.hasNext();) { + action.accept(itr.next()); + } + } + default TSpliterator spliterator() { TIterator iterator = iterator(); return new TSpliterator() {