public void remove() throws IllegalStateException {
        if (!canRemove) {
            throw new IllegalStateException();
        }
        hitGroup.remove(index);
        index--;
        canRemove = false;
    }
Whether the iterator is in a state where remove is OK
container-search/src/main/java/com/yahoo/search/result/HitIterator.java