Brian Goetz brian.goetz at
Wed Jan 9 14:17:55 PST 2013

Sum is built into primitive streams:

   int sum = intStream.sum();

and count is trivial:

   int count = -> 1).sum();

On 1/9/2013 5:07 PM, Aleksey Shipilev wrote:
> On 01/10/2013 02:03 AM, Brian Goetz wrote:
>> On the other hand, I'd like for IntCountAndSum to be a private
>> implementation detail of average -- that Average would be a
>> Collector<Integer,Double> rather than leaking IntCountAndSum.  Working
>> on that now.
> Great, thanks. Now, can we also have the Count and Sum collectors? Or
> that clashes with primitive terminals?
> -Aleksey.

More information about the lambda-dev mailing list