class SortingEntitySelector<Solution_> extends AbstractCachingEntitySelector<Solution_> {

    private final SelectionSorter<Solution_, Object> sorter;

    public SortingEntitySelector(EntitySelector<Solution_> childEntitySelector, SelectionCacheType cacheType,
            SelectionSorter<Solution_, Object> sorter) {
        super(childEntitySelector, cacheType);
        this.sorter = sorter;
    }

    // ************************************************************************
    // Worker methods
    // ************************************************************************

    @Override
    public void constructCache(SolverScope<Solution_> solverScope) {<FILL_FUNCTION_BODY>}

    @Override
    public boolean isNeverEnding() {
        return false;
    }

    @Override
    public Iterator<Object> iterator() {
        return cachedEntityList.iterator();
    }

    @Override
    public ListIterator<Object> listIterator() {
        return cachedEntityList.listIterator();
    }

    @Override
    public ListIterator<Object> listIterator(int index) {
        return cachedEntityList.listIterator(index);
    }

    @Override
    public boolean equals(Object o) {
        if (this == o)
            return true;
        if (o == null || getClass() != o.getClass())
            return false;
        if (!super.equals(o))
            return false;
        SortingEntitySelector<?> that = (SortingEntitySelector<?>) o;
        return Objects.equals(sorter, that.sorter);
    }

    @Override
    public int hashCode() {
        return Objects.hash(super.hashCode(), sorter);
    }

    @Override
    public String toString() {
        return "Sorting(" + childEntitySelector + ")";
    }

}

        super.constructCache(solverScope);
        sorter.sort(solverScope.getScoreDirector(), cachedEntityList);
        logger.trace("    Sorted cachedEntityList: size ({}), entitySelector ({}).",
                cachedEntityList.size(), this);
    
<methods>public void <init>(EntitySelector<Solution_>, org.optaplanner.core.config.heuristic.selector.common.SelectionCacheType) ,public void constructCache(SolverScope<Solution_>) ,public void disposeCache(SolverScope<Solution_>) ,public Iterator<java.lang.Object> endingIterator() ,public boolean equals(java.lang.Object) ,public org.optaplanner.core.config.heuristic.selector.common.SelectionCacheType getCacheType() ,public EntitySelector<Solution_> getChildEntitySelector() ,public EntityDescriptor<Solution_> getEntityDescriptor() ,public long getSize() ,public int hashCode() ,public boolean isCountable() <variables>protected final non-sealed org.optaplanner.core.config.heuristic.selector.common.SelectionCacheType cacheType,protected List<java.lang.Object> cachedEntityList,protected final non-sealed EntitySelector<Solution_> childEntitySelector