Type safety bug for Spliterators.spliterator

Martin Buchholz martinrb at google.com
Mon Feb 24 18:51:07 PST 2014


On Mon, Feb 24, 2014 at 4:38 PM, Zhong Yu <zhong.j.yu at gmail.com> wrote:

> T[] to Spliterator<T> is not general enough, we'll need T[] to
> Spliterator<S> where S is a subtype of T. Caller guarantees that the
> T[] array contains only S elements.
>
> So we might want something like
>
>     <T, S extends T> Spliterator<S> spliterator(T[] array, int)
>

Don't you want S super T instead?

I might agree, but the Arrays method wasn't flexible in this way either.


More information about the lambda-dev mailing list