class CachedListRandomIterator<S> extends SelectionIterator<S> {

    protected final List<S> cachedList;
    protected final Random workingRandom;
    protected final boolean empty;

    public CachedListRandomIterator(List<S> cachedList, Random workingRandom) {
        this.cachedList = cachedList;
        this.workingRandom = workingRandom;
        empty = cachedList.isEmpty();
    }

    @Override
    public boolean hasNext() {
        return !empty;
    }

    @Override
    public S next() {<FILL_FUNCTION_BODY>}

}

        if (empty) {
            throw new NoSuchElementException();
        }
        int index = workingRandom.nextInt(cachedList.size());
        return cachedList.get(index);
    
<methods>public non-sealed void <init>() ,public void remove() <variables>