### Question:
FilterIterator extends AbstractIterator<E> { public FilterIterator(Iterator<? extends E> iterator, Predicate<? super E> filter) { Validate.notNull(iterator, "iterator must not be null"); Validate.notNull(filter, "filter must not be null"); this.iterator = iterator; this.filter = filter; } FilterIterator(Iterator<? extends E> iterator, Predicate<? super E> filter); @Override void remove(); @Override String toString();  }### Answer:
@Test public void testFilterIterator() { assertTrue(iterator.hasNext()); assertEquals((Integer)2, iterator.next()); assertTrue(iterator.hasNext()); assertEquals((Integer)4, iterator.next()); assertTrue(iterator.hasNext()); assertEquals((Integer)6, iterator.next()); assertTrue(iterator.hasNext()); assertEquals((Integer)8, iterator.next()); assertTrue(iterator.hasNext()); assertEquals((Integer)10, iterator.next()); assertFalse(iterator.hasNext()); assertFalse(iterator.hasNext()); }