List of usage examples for java.util DoubleSummaryStatistics getCount
public final long getCount()
From source file:Main.java
public static void main(String[] args) { DoubleSummaryStatistics stats = new DoubleSummaryStatistics(); stats.accept(100.0);//from ww w.j a v a 2 s. co m stats.accept(300.0); stats.accept(230.0); stats.accept(532.0); stats.accept(422.0); long count = stats.getCount(); double sum = stats.getSum(); double min = stats.getMin(); double avg = stats.getAverage(); double max = stats.getMax(); System.out.printf("count=%d, sum=%.2f, min=%.2f, average=%.2f, max=%.2f%n", count, sum, min, max, avg); }
From source file:org.apache.metron.indexing.dao.metaalert.MetaScores.java
public MetaScores(List<Double> scores) { // A meta alert could be entirely alerts with no values. DoubleSummaryStatistics stats = scores.stream().mapToDouble(a -> a).summaryStatistics(); metaScores.put("max", stats.getMax()); metaScores.put("min", stats.getMin()); metaScores.put("average", stats.getAverage()); metaScores.put("count", stats.getCount()); metaScores.put("sum", stats.getSum()); // median isn't in the stats summary double[] arr = scores.stream().mapToDouble(d -> d).toArray(); metaScores.put("median", new Median().evaluate(arr)); }