### Question:
WindowCounter { public boolean allMatch(IntPredicate predicate) { return Arrays.stream(history).allMatch(predicate); } WindowCounter(int capacity); int getLastIndex(); void record(int snapshot); int getHistory(); boolean allMatch(IntPredicate predicate);  }### Answer:
@Test public void testAllMatch() throws Exception { WindowCounter counter = new WindowCounter(5); counter.record(1); counter.record(2); counter.record(3); Assert.assertFalse(counter.allMatch(i -> i > 0)); counter.record(4); counter.record(5); Assert.assertTrue(counter.allMatch(i -> i > 0)); Assert.assertFalse(counter.allMatch(i -> i > 1)); }