sum of numbers using Primitives range

Michael Nascimento misterm at gmail.com
Tue Dec 11 17:55:15 PST 2012


There is no Javadoc, so it's hard to say, but isn't it because the
range is supposed to be open in the end?

Regards,
Michael

On Tue, Dec 11, 2012 at 11:46 PM, Arul Dhesiaseelan <aruld at acm.org> wrote:
> Sum of integers over using a Primitives range returns invalid result.
>
>     range(1, 10).map(operand -> operand).sum();
>     range(1, 10).reduce(0, Integer::sum);
>     range(1, 10).sum();
>
>
> They all yield 45, instead of 55. Is this a bug?
>
> -Arul
>


More information about the lambda-dev mailing list