class FilteringIterator implements Iterator<T> {

    @Override
    public T next() {
        if (state == State.FRESH || state == State.NEXT_RETRIEVED) {
            advance();
        }
        if (state == State.DONE) {
            throw new NoSuchElementException();
        }
        assert state == State.NEXT_PENDING : state;
        state = State.NEXT_RETRIEVED;
        return next;
    }

    public  FilteringIterator(Iterator<T> delegate, boolean isMutable);

}