LongMomentStatistics extends MomentStatistics implements LongConsumer, IntConsumer { public boolean sameState(final LongMomentStatistics other) { return this == other || _min == other._min && _max == other._max && _sum == other._sum && super.sameState(other); } LongMomentStatistics(); @Override void accept(final long value); @Override void accept(final int value); LongMomentStatistics combine(final LongMomentStatistics other); long min(); long max(); long sum(); boolean sameState(final LongMomentStatistics other); LongMoments toLongMoments(); @Override String toString(); static Collector<T, ?, LongMomentStatistics> toLongMomentStatistics(final ToLongFunction<? super T> mapper);  }
@Test public void sameState() { final LongMomentStatistics ms1 = new LongMomentStatistics(); final LongMomentStatistics ms2 = new LongMomentStatistics(); final Random random = new Random(); for (int i = 0; i < 100; ++i) { final long value = random.nextInt(1_000_000); ms1.accept(value); ms2.accept(value); Assert.assertTrue(ms1.sameState(ms2)); Assert.assertTrue(ms2.sameState(ms1)); Assert.assertTrue(ms1.sameState(ms1)); Assert.assertTrue(ms2.sameState(ms2)); } }