RFR: 8015315: Stream.concat methods
henry.jen at oracle.com
Wed Jul 3 21:20:55 UTC 2013
On 07/01/2013 02: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.
As Peter pointed out, it's convariant like Iterator, so it is a safe cast.
The public API had correct signature, as the internal implementation,
looks like we just have to push the cast around as we work out the
Spliterator type system with primitives. Thus current implementation
seems to be just fine.
More information about the core-libs-dev