Streams.concat for primitives

Brian Goetz brian.goetz at oracle.com
Sun Feb 17 11:57:01 PST 2013


> Any plans to implement Streams.concat in case of IntStream ?

Not currently.

> Another question, why concat is not  member of stream ?

It was, until we changed it.

If you look at all the other methods of Stream, all the arguments to 
their methods are stateless.  Stream would have been an exception (so 
was into(collection)) and would have caused problems for defining stream 
pipelines as functions separate from their source (what we sometimes 
called "detached pipelines", were you would define the computational 
process X.filter(...).map(...).reduce(...) separate form its source, so 
it would be a function from Stream to the reduction result, and 
therefore could amortize the pipeline setup over multiple uses (enabling 
further optimizations that are impractical for one-shot pipelines.))

Further, the value of defining concat() as a stream method (and 
therefore make it eligible for chaining) is low, since you still have to 
set up the other pipeline and that often doesn't chain so well anyway.



More information about the lambda-dev mailing list