Two small points of feedback

Anthony Vanelverdinghe anthony.vanelverdinghe at
Sat Jan 5 07:45:45 PST 2013

Why not:

indices(int from, int to) or indexRange(int from, int to)      = 
right-open interval
range(int from, int to)                           = closed interval

? Because that 's what right-open intervals are used for: indexing an 
array, a String, a Collection, ...

To range over all integers (I don't believe this is possible with the 
current API?), you would then have:
     range(Integer.MIN_VALUE, Integer.MAX_VALUE)
To range over the months:
     range(1, 12)

If desired, you could even overload indices with some convenience 
methods like:

indices(String s)                           = indices(0, s.length())
indices(Collection c)                    = indices(0, c.size())

Kind regards, Anthony

Op 4/01/2013 16:05, Brian Goetz schreef:
>> 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.
> Given that either approach will be "surprising" to someone when taken
> out of context (with 10M Java developers, someone will be surprised at
> *anything*), I think you'd be pretty hard pressed to argue against
> adopting the way the vast majority of similar JDK mechanisms work?

More information about the lambda-dev mailing list