Concat operation

Paul Sandoz Paul.Sandoz at oracle.com
Tue Sep 18 08:26:34 PDT 2012


On Sep 18, 2012, at 4:15 PM, Paul Benedict <pbenedict at apache.org> wrote:
> Shouldn't it be illegal to concat on an infinite stream? I propose throwing ISE if the target stream is infinite.
> 

I am inclined to think in such a case it would be a redundant operation (that could be removed from the pipeline) and throwing exceptions should be for cases where something is known to blow up, like filling up an array from an infinite source.

There are a number of ways a pipeline can be constructed such that concatenation may not occur e.g.:
 
  stream.concat(anotherStream).limit(10)
  stream.concat(anotherStream).findFirst();

Paul.


More information about the lambda-dev mailing list