DoubleMomentStatistics extends MomentStatistics implements DoubleConsumer { public boolean sameState(final DoubleMomentStatistics other) { return this == other || Double.compare(_min, other._min) == 0 && Double.compare(_max, other._max) == 0 && _sum.sameState(other._sum) && super.sameState(other); } DoubleMomentStatistics(); @Override void accept(final double value); DoubleMomentStatistics combine(final DoubleMomentStatistics other); double min(); double max(); double sum(); boolean sameState(final DoubleMomentStatistics other); DoubleMoments toDoubleMoments(); DoubleMoments result(); @Override String toString(); static Collector<T, ?, DoubleMomentStatistics> toDoubleMomentStatistics(final ToDoubleFunction<? super T> mapper);  }
@Test public void sameState() { final DoubleMomentStatistics dms1 = new DoubleMomentStatistics(); final DoubleMomentStatistics dms2 = new DoubleMomentStatistics(); final Random random = new Random(); for (int i = 0; i < 100; ++i) { final double value = random.nextDouble(); dms1.accept(value); dms2.accept(value); Assert.assertTrue(dms1.sameState(dms2)); Assert.assertTrue(dms2.sameState(dms1)); Assert.assertTrue(dms1.sameState(dms1)); Assert.assertTrue(dms2.sameState(dms2)); } }