Collection spliterator that does not depend on how the list implementation implements spliterator()
@@ -58,9 +58,8 @@ public class TSpliterators {
};
}
- @SuppressWarnings("unchecked")
public static <T> TSpliterator<T> spliterator(Collection<? extends T> c, int characteristics) {
- return ((TCollection<T>) c).spliterator();
+ return spliterator(c.iterator(), c.size(), characteristics);
}
public static TSpliterator.OfInt spliterator(int[] array, int additionalCharacteristics) {
