Concat operation

Paul Benedict pbenedict at apache.org
Tue Sep 18 08:23:27 PDT 2012


David's recommendation is better. I think returning the infinite stream is
more proper functionality.

Paul

On Tue, Sep 18, 2012 at 9:37 AM, David M. Lloyd <david.lloyd at redhat.com>wrote:

> I think it might be more correct to simply return the infinite stream
> and clear/discard the additional stream.  I could see cases where you
> don't need or want to know whether the target is infinite or not, but
> you want to add a certain group to the end if there *is* an end (but if
> there isn't, it wouldn't matter).
>
> On 09/18/2012 09:15 AM, Paul Benedict wrote:
> > Shouldn't it be illegal to concat on an infinite stream? I propose
> throwing
> > ISE if the target stream is infinite.
> >
> > On Tue, Sep 18, 2012 at 7:12 AM, Paul Sandoz <paul.sandoz at oracle.com>
> wrote:
> >
> >> Hi,
> >>
> >> Please see here for a first go at implementing concat:
> >>
> >>    http://cr.openjdk.java.net/~psandoz/lambda/concat/webrev/
> >>
> >> I chose to implement:
> >>
> >>    stream.concat(anotherStream)
> >>
> >> so that the elements of "anotherStream" are concatenated on to end of
> >> "stream".
> >>
> >> This operation has side-effects.
> >>
> >> I am not sure how this operation relates to MapStream.mergeWith.
> >>
> >> I pulled out the concatenating of Iterator<Iterator<T>> from TreeUtils,
> >> spruced (no pun intended) it up, and placed it in Iterators for reuse.
> >>
> >> There is only the dumb parallel implementation. One wonders for the
> >> parallel case whether concat should be pseudo-random interleave :-)
> >>
> >> I updated the StreamOpTestCase exercise methods to take a
> >> Factory<IntermediateOp[]> since concat has side-effects:
> >>
> >>          exerciseFOp(data, () -> ConcatOp.make(data.seqStream()));
> >>
> >> (Another TODO for these test methods is to select which cases to test).
> >>
> >> Paul.
> >>
> >>
> >
>
>
> --
> - DML
>
>
>
>


More information about the lambda-dev mailing list