Static methods on Stream and friends

Joe Bowbeer joe.bowbeer at
Mon May 6 00:18:34 PDT 2013

I just updated to b88 and I needed to update my code to adjust for the
migration of methods out of Streams.

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?


On Sun, Apr 21, 2013 at 11:19 AM, Brian Goetz <brian.goetz at>wrote:

> I moved the following from Streams to Stream:
>   Stream.builder()
>   Stream.empty()
>   Stream.singleton(T)
>   Stream.of(T...)
>   Stream.iterate(T, T -> T)
>   Stream.generate(i -> T)
> with the same on {Int,Long,Double}Stream, and also
>   {Int,Long,Double}Stream.range(**start, end)
>   {Int,Long,Double}Stream.range(**start, end, step)
> It was suggested on lambda-dev that we should rename singleton to simply
> be an overload of "of":
>   Stream.of(T)
>   Stream.of(T...)
> which seems reasonable.
> Remaining open issues:
>  - Some people are unhappy that range is half-open (which also means
> people are constrained to ranges topping out at MAX_VALUE-1 rather than
> MAX_VALUE).  Some options:
>    - Add XxxStream.rangeExclusive(**start, end)
>    - Further doc hints, such as renaming the parameters to startInclusive
> / endExclusive
>    - Nothing
>  - Paul has suggested that generate be finite.  While this is kind of
> yucky, the practical difference between infinite and long-sized is pretty
> much negligible, and the version based on LongStream.range().map()
> parallellizes much better.
> I propose to accept the suggestion of s/singleton/of/, go the "doc hint"
> route on range, and go finite on generate.
> Also never closed on whether there was value to ints() / longs() -- these
> show up in lots of teaching examples, though less so in real-world code.
>  Still, teaching people how to think about this stuff is important.

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