RFR 8015895 Int/LongStream.range/rangeClosed

Paul Sandoz paul.sandoz at oracle.com
Wed Jun 5 13:10:45 UTC 2013


The following was decided by the JSR-335 EG:

1) Int/LongStream.range are restricted to a fixed step of 1. The map operation can be used to adjust the step.

2) Int/LongStream.rangeClosed methods were added for a closed range with a fixed step of 1, in addition to the half open range of 1).


The range spliterator implementations also have some biasing of the splits for large ranges, since the larger the range the more likely it will be used in conjunction with limit or another form of short-circuiting operation. This was intentionally kept simple for the moment: a ratio of 1:7 in size for left:right when the size is > 2^24.

There is some code commented out in the implementation and tests which will be uncommented once Stream concatenation makes it's way into TL. I wanted to get this in sooner rather than be blocked waiting on concatenation. Stream concatenation will be used in LongStream for edge cases when the range is > Long.MAX_VALUE e.g. LongStream.range(Long.MIN_VALUE, Long.MAX_VALUE), LongStream.rangeClosed(0, Long.MAX_VALUE).

This webrev is layered on top of:



More information about the core-libs-dev mailing list