If we are going to target Java 8  with commons-statistics, then we should
make use of the built in DoubleSummaryStatistics() (
https://docs.oracle.com/javase/8/docs/api/java/util/DoubleSummaryStatistics.html)
class, related classes for other numeric types, and related interfaces in
the Collectors() class.

I see a clear niche within commons for a convenience class that allows the
user to simply pass an array and a requested statistic, rather than build a
stream. Overloaded methods ( for example getMean(double[] d) and
getMean(long[] l) ) would handle whether, for example,
DoubleSummaryStatistics or LongSummaryStatistics need be called and the
return value could simply be the desired statistic.

 That would take care of Mean, Min, Max Sum, and Count.

I think the rest of the summary stats can be gathered by mapping
intermediate operations onto the same streams. For example, mapping each
value onto its square before calling SummaryStatistics(), then dividing the
sum of the mapped stream by its count, would return standard deviation.
That also seems to me a nice niche for commons, delivering additional
summary statistics beyond  the built-ins.

Given that a lot of the key functionality is built-in the scope of this
project seems better suited for a SummaryStatistics class with static
methods.

If this sounds good I'll start a branch to develop it.

Eric

Reply via email to