sum return type for primitive streams

Brian Goetz brian.goetz at
Fri Feb 1 09:27:41 PST 2013

Yep, that basically "sums" up the thought process we went through. 
There's no perfect answer, but this seems the least surprising.

On 2/1/2013 12:23 PM, Ali Lahijani wrote:
> On Fri, Feb 1, 2013 at 8:18 PM, Brian Goetz <brian.goetz at
> <mailto:brian.goetz at>> wrote:
>         Sorry to bring it up again, but integers also form a monoid
>         under min, max.
>         With Integer.MIN_VALUE and Integer.MAX_VALUE being the obvious
>         identities.
>     And what about longs?  Having the same operation with different
>     identities for coincident sets is pretty confusing.
> You're right, we usually view int and long as approximations of
> mathematical integers, which have no top/bottom elements. So main/max on
> pure infinite integers (BigIntegers) do not have an identity.
> One could argue that when you are using an IntStream or LongStream
> instead of a Steam<BigIntegers>, you have already decided that you only
> need a finite subset of mathematical integers, so you should be prepared
> to see MIN_VALUE and MAX_VALUE used as positive/negative infinity. But I
> don't see that argument persuading anyone.
> So, in such an imperfect world, I guess there is no better answer for
> this question.
> Best

More information about the lambda-dev mailing list