Concat operation
Paul Sandoz
paul.sandoz at oracle.com
Tue Sep 18 05:12:58 PDT 2012
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.
More information about the lambda-dev
mailing list