Loose end: ints(), longs()

Sam Pullara spullara at gmail.com
Tue May 28 11:16:12 PDT 2013

On May 28, 2013, at 11:05 AM, Brian Goetz <brian.goetz at oracle.com> wrote:
> I think Paul's addition of rangeClosed to handle closed ranges (previously discussed) proposal is also uncontroversial?

or just have an override that has:

range(start, isInclusive, end, isInclusive)

to cover the bases.

> as{Ints,Longs} but keep boxed()

I vote for these.


> etc...
> On 5/28/2013 12:26 PM, Brian Goetz wrote:
>> Another loose end is a method to generate "all" ints / longs (which are
>> sugar for ranges 0..MAX_VALUE.)  These show up in pedagogical examples
>> all the time:
>>   ints().filter(i -> isPrime(i)).limit(100)
>> The logical place for them is:
>>   IntStream.ints()
>>   LongStream.longs()
>> but some have raised concern that this might be confusing because we
>> have an instance method on IntStream called "longs()" which widens the
>> elements from int to long.  While this isn't fatal, it might be confusing.
>> Perhaps it would be better to rename these conversion methods:
>>   IntStream: longs(), doubles(), boxed()
>>   LongStream: doubles(), boxed()
>>   DoubleStream: boxed()
>> to asInts(), asLongs(), and asBoxed()?
>> In retrospect, these seem better names anyway.  And they also eliminate
>> the conflict above.

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