IntStream.sum

Paul Sandoz paul.sandoz at oracle.com
Wed Jan 16 05:53:28 PST 2013


On Jan 16, 2013, at 2:33 PM, Remi Forax <forax at univ-mlv.fr> wrote:

> On 01/16/2013 02:32 PM, Paul Sandoz wrote:
>> On Jan 16, 2013, at 2:15 PM, Remi Forax <forax at univ-mlv.fr> wrote:
>>>> And long can hold the result of MAXINT additions?
>>>> 
>>> stream are sized is store in a long if a size if definite or can be infinite
>>> so it solves nothing.
>>> 
>> I don't quite understand the above sentence. Are you suggesting reducing/folding on a infinite stream?
> 
> yes, and you throw an exception when you've done, Brian talk about that.
> 

Well don't reduce/fold on a infinite stream :-)

I don't really buy into your argument that because there might be streams of size > Integer.MAX_VALUE that it implies sum() solves nothing, seems a rather extreme position to take. Do you think sum() solves nothing regardless of whether it returns an int or long? 

Paul.


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