RFR: 8015315: Stream.concat methods
peter.levart at gmail.com
Mon Jul 1 11:36:35 UTC 2013
On 07/01/2013 11:52 AM, Remi Forax wrote:
> On 06/29/2013 02:58 AM, Henry Jen wrote:
>> Please review the webrev that add concat static method to Stream and
>> primitive Streams.
> Hi Henry,
> I find the the cast to Spliterator<T> in Streams.concat() dubious,
> I can not see how it can be correct, could you explain why this cast
> is Ok.
I think that if we want to concat say Stream<Integer> with Stream<Long>,
producing Stream<Number>, there would have to be an unsafe cast
somewhere. Since Stream<T> API apears to be covariant (like for example
Iterator<T>), casting Stream<? extends T> to Stream<T> seems to be safe.
More information about the core-libs-dev