IntMomentStatistics extends MomentStatistics implements IntConsumer { public boolean sameState(final IntMomentStatistics other) { return this == other || _min == other._min && _max == other._max && _sum == other._sum && super.sameState(other); } IntMomentStatistics(); @Override void accept(final int value); IntMomentStatistics combine(final IntMomentStatistics other); int min(); int max(); long sum(); boolean sameState(final IntMomentStatistics other); IntMoments toIntMoments(); @Override String toString(); static Collector<T, ?, IntMomentStatistics> toIntMomentStatistics(final ToIntFunction<? super T> mapper);  }
@Test public void sameState() { final IntMomentStatistics ims1 = new IntMomentStatistics(); final IntMomentStatistics ims2 = new IntMomentStatistics(); final Random random = new Random(); for (int i = 0; i < 100; ++i) { final int value = random.nextInt(1_000_000); ims1.accept(value); ims2.accept(value); Assert.assertTrue(ims1.sameState(ims2)); Assert.assertTrue(ims2.sameState(ims1)); Assert.assertTrue(ims1.sameState(ims1)); Assert.assertTrue(ims2.sameState(ims2)); } }