DeciderIterator implements Iterator<T> { public DeciderIterator(DeciderIF<T> decider, Iterator<T> iterator) { this.decider = decider; this.iterator = iterator; findNext(); } DeciderIterator(DeciderIF<T> decider, Iterator<T> iterator); @Override boolean hasNext(); @Override T next(); @Override void remove();  }
@Test public void testDeciderIterator() { int size = 5; DeciderIF decider = new DeciderIF() { @Override public boolean ok(Object object) { return !"B".equals(object); } }; Iterator iter = new DeciderIterator(decider, getIterator(size)); testIterator(iter, size - 1); }