MedianFilter implements Filter<T> { @Override public Iterator<Double> iterator() { return filtered.iterator(); } MedianFilter(Iterable<T> data, int windowSize); @Override Iterator<Double> iterator();  }
@Test public void testIteratorIsEmptyWhenFilterWindowLargerThanDataToBeFiltered() { List<Integer> data = Arrays.asList(3, 8, 5, 6, 4, 9); int windowSize = data.size() + 1; MedianFilter<Integer> medianFilter = new MedianFilter<>(data, windowSize); boolean hasNext = medianFilter.iterator().hasNext(); assertThat(hasNext, is(false)); }