Collection spliterator that does not depend on how the list implementation implements spliterator()

This commit is contained in:
Colorize 2020-01-26 14:37:42 +01:00 committed by Alexey Andreev
parent 7a2cd6ae4f
commit c30e2d3c24

View File

@ -57,10 +57,9 @@ 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) {