class CheckedIterator {

    @NonNull
    public List<E> toList() throws T {
        List<E> result = new ArrayList<>();
        while (hasNext()) {
            result.add(next());
        }
        return result;
    }

}