APISonar


java.util.DoubleSummaryStatistics.DoubleSummaryStatistics

> java > util > DoubleSummaryStatistics > DoubleSummaryStatistics
java APIs util APIs DoubleSummaryStatistics APIs DoubleSummaryStatistics APIs

Example 1
private static DoubleSummaryStatistics getDoubleSummaryStatisticsData2() {
        DoubleSummaryStatistics dss = new DoubleSummaryStatistics();
        for (double value : data2) {
            dss.accept(value);
        }
        return dss;
    }
Example 2
public static <T> DoubleSummaryStatistics summarizeDouble(T[] items, int size, DoubleFunction<? super T> function)
    {
        DoubleSummaryStatistics stats = new DoubleSummaryStatistics();
        for (int i = 0; i < size; i++)
        {
            T item = items[i];
            stats.accept(function.doubleValueOf(item));
        }
        return stats;
    }
Example 3
public void testFinite() throws Exception {
        DoubleSummaryStatistics stats = new DoubleSummaryStatistics();
        stats.accept(10.0/3);
        stats.accept(-0.1);

        DoubleSummaryStatistics deserialized = deserialize(stats);
        assertStatsAreEqual(stats, deserialized);
    }
Example 4
public void test_empty() {
        DoubleSummaryStatistics dss = new DoubleSummaryStatistics();
        assertEquals(0, dss.getCount());
        assertEquals(0.0d, dss.getSum());
        assertEquals(0.0d, dss.getAverage());
        assertEquals(Double.POSITIVE_INFINITY, dss.getMin());
        assertEquals(Double.NEGATIVE_INFINITY, dss.getMax());
    }
Example 5
protected Factory<DoubleSummary> factory() {
		return () -> {
			final Random random = RandomRegistry.getRandom();

			final DoubleSummaryStatistics statistics = new DoubleSummaryStatistics();
			IntStream.range(0, 100)
				.mapToDouble(i -> random.nextDouble())
				.forEach(statistics);

			return DoubleSummary.of(statistics);
		};
	}