Spec and API review for {Int,Long,Double}SummaryStatistics

Joe Bowbeer joe.bowbeer at gmail.com
Thu Mar 28 18:55:14 PDT 2013

Why not have is.getSum return long?

Does getSum of a long stream throw an exception?
On Mar 28, 2013 7:37 PM, "Mike Duigou" <mike.duigou at oracle.com> wrote:

> I've responded to the survey feedback and updated the implementations with
> additional Javadoc.
> One comment which was not addressed was whether getAverage() should throw
> a zero division ArithmeticException if no values had been recorded. I
> believe the current default of returning 0.0 is reasonable and it is
> convenient to not have to check the catch the exception. It's also in line
> with the defaults we provide for sum, sumOfSquares, min, and max. For any
> of these defaults users can check the count themselves and choose to
> substitute their own default. double average = summary.getCount() != 0 ?
> summary.getAverage() : Double.NAN;
> I did introduce an ArithmeticException to IntSummaryStatistics.getSum() if
> the sum cannot be expressed as an int. Remember that the sum  is internally
> maintained in a long and there is a long accessor, getAsLong().
> Mike
> On Mar 22 2013, at 15:00 , Brian Goetz wrote:
> > I've posted a survey at:
> >  https://www.surveymonkey.com/s/5VTLT26
> >
> > To do an API and spec review for the classes
> Int/Long/DoubleSummaryStatistics.  If you have comments, please provide
> them in the SurveyMonkey form.  Usual password.
> >
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/lambda-libs-spec-experts/attachments/20130328/f8c959c7/attachment.html 

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