Two small points of feedback

Stephen Colebourne scolebourne at
Fri Jan 4 07:49:29 PST 2013

On 4 January 2013 15:05, Brian Goetz <brian.goetz at> wrote:
>> My theory is that its because the numbers are discrete. "From Monday
>> to Wednesday" is closed in normal language, whereas "from 09:00 to
>> 17:00" is not. Similarly "the TV channels 1 to 4" is closed, but "from
>> 1.3 to 8.6" is more likely to be half-open.
> And what about
>   string.substring(0, 10)
> or
>   Arrays.sort(a, 0, 10)
> or...?   These have discrete numbers too.

These are indices into a list/array/string. Range defines the set of
ints themselves. These is related but not entirely the same. (indices
point at the gaps between things, a range of ints points at the things
themselves). So, yes, I think there is a conceptual difference.

I believe you need two methods. One of these three options:
- rangeInclusive()
- rangeExclusive()

- range()
- rangeExclusive()

- range()
- rangeInclusive()

I don't currently have a strong preference between them.

I don't support a boolean flag on range() as that is meaningless. An
enum would be too verbose IMO.

More information about the lambda-dev mailing list