sum of numbers using Primitives range

Arul Dhesiaseelan aruld at acm.org
Tue Dec 11 17:46:54 PST 2012


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