From c30e2d3c244ab611e6377dace3a86b1d8d1f4e1e Mon Sep 17 00:00:00 2001 From: Colorize Date: Sun, 26 Jan 2020 14:37:42 +0100 Subject: [PATCH] Collection spliterator that does not depend on how the list implementation implements spliterator() --- .../java/org/teavm/classlib/java/util/TSpliterators.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/classlib/src/main/java/org/teavm/classlib/java/util/TSpliterators.java b/classlib/src/main/java/org/teavm/classlib/java/util/TSpliterators.java index 7fc2a4b84..28accc844 100644 --- a/classlib/src/main/java/org/teavm/classlib/java/util/TSpliterators.java +++ b/classlib/src/main/java/org/teavm/classlib/java/util/TSpliterators.java @@ -57,10 +57,9 @@ public class TSpliterators { } }; } - - @SuppressWarnings("unchecked") + public static TSpliterator spliterator(Collection c, int characteristics) { - return ((TCollection) c).spliterator(); + return spliterator(c.iterator(), c.size(), characteristics); } public static TSpliterator.OfInt spliterator(int[] array, int additionalCharacteristics) {