Static methods on Stream and friends

Brian Goetz brian.goetz at oracle.com
Mon May 6 06:07:47 PDT 2013


> Now in b88, Streams contains only concat and zip, which seems odd.
>   Isn't there more for Streams to do?  Or is Streams going away?
>
> http://download.java.net/lambda/b88/docs/api/java/util/stream/Streams.html

And this was my next question.

There's a lot of package-private code, but at this point, no other 
public entry points.

With static methods in interfaces, a lot of code that used to go in Foos 
can now go in Foo.  But I think it is definitely possible to take this 
too far (think of the 5000 LoC currently in Collections; would we want 
to move it *all* to the various Collection interfaces?)

Still, concat() has a decidedly different flavor to the other Stream 
methods; all the other stream methods take stateless (and therefore 
reusable) behavioral descriptions of how to produce transform a stream, 
whereas concat() takes another *stream*, which will be consumed in the 
process.

So my inclination would be, if we keep these methods, to leave them in 
Streams.



More information about the lambda-libs-spec-experts mailing list