use of java.util.DoubleSummaryStatistics in project hazelcast-jet by hazelcast.
the class CollectorsTest method list_summarizingDouble.
@Test
public void list_summarizingDouble() {
DoubleSummaryStatistics summary = streamList().collect(DistributedCollectors.summarizingDouble(m -> (double) m));
assertEquals(COUNT, summary.getCount());
assertEquals(COUNT - 1, summary.getMax(), 0d);
assertEquals(0, summary.getMin(), 0d);
assertEquals(COUNT * (COUNT - 1) / 2d, summary.getSum(), 0d);
assertEquals((COUNT - 1) / 2d, summary.getAverage(), 0d);
}
use of java.util.DoubleSummaryStatistics in project hazelcast-jet by hazelcast.
the class DoubleStreamTest method summaryStatistics.
@Test
public void summaryStatistics() {
DoubleSummaryStatistics longSummaryStatistics = stream.summaryStatistics();
assertEquals(COUNT, longSummaryStatistics.getCount());
assertEquals(COUNT - 1, longSummaryStatistics.getMax(), 0D);
assertEquals(0, longSummaryStatistics.getMin(), 0D);
assertEquals(COUNT * (COUNT - 1) / 2, longSummaryStatistics.getSum(), 0D);
assertEquals((COUNT - 1) / 2D, longSummaryStatistics.getAverage(), 0D);
}
use of java.util.DoubleSummaryStatistics in project j2objc by google.
the class DoubleSummaryStatisticsTest method test_getCount.
public void test_getCount() {
DoubleSummaryStatistics dss1 = getDoubleSummaryStatisticsData1();
assertEquals(data1.length, dss1.getCount());
}
use of java.util.DoubleSummaryStatistics in project j2objc by google.
the class DoubleSummaryStatisticsTest method test_getAverage.
public void test_getAverage() {
DoubleSummaryStatistics dss1 = getDoubleSummaryStatisticsData1();
assertEquals(21.2, dss1.getAverage(), 1E-6);
dss1.accept(Double.NaN);
assertEquals(Double.NaN, dss1.getAverage());
}
Aggregations