class CheckedIterator {

    @NonNull
    public CheckedIterator<E, T> filter(@NonNull final Predicate<? super E> predicate) {
        requireNonNull(predicate);
        final CheckedIterator<E, T> unfiltered = this;
        return new ACheckedIterator<E, T>() {
            @Override
            protected E computeNext() throws T {
                while (unfiltered.hasNext()) {
                    E element = unfiltered.next();
                    if (predicate.test(element)) {
                        return element;
                    }
                }
                return endOfData();
            }
        };
    }

}