optaplanner-core/src/main/java/org/optaplanner/core/impl/heuristic/selector/value/decorator/AbstractCachingValueSelector.java
@Override
    public void constructCache(DefaultSolverScope solverScope) {
        long childSize = childValueSelector.getSize();
        if (childSize > (long) Integer.MAX_VALUE) {
            throw new IllegalStateException("The selector (" + this
                    + ") has a childValueSelector (" + childValueSelector
                    + ") with childSize (" + childSize
                    + ") which is higher than Integer.MAX_VALUE.");
        }
        cachedValueList = new ArrayList<>((int) childSize);
        // TODO Fail-faster if a non FromSolutionPropertyValueSelector is used
        childValueSelector.iterator().forEachRemaining(cachedValueList::add);
        logger.trace("    Created cachedValueList: size ({}), valueSelector ({}).",
                cachedValueList.size(), this);
    }
@Override
    public void constructCache(DefaultSolverScope solverScope) {
        long childSize = childValueSelector.getSize();
        if (childSize > (long) Integer.MAX_VALUE) {
            throw new IllegalStateException("The selector (" + this
                    + ") has a childValueSelector (" + childValueSelector
                    + ") with childSize (" + childSize
                    + ") which is higher than Integer.MAX_VALUE.");
        }
        cachedValueList = new ArrayList<>((int) childSize);
        // TODO Fail-faster if a non FromSolutionPropertyValueSelector is used
        childValueSelector.iterator().forEachRemaining(cachedValueList::add);
        logger.trace("    Created cachedValueList: size ({}), valueSelector ({}).",
                cachedValueList.size(), this);
    }
@ Override public void constructCache ( DefaultSolverScope solverScope ) { long childSize = childValueSelector . getSize ( ) ; if ( childSize > ( long ) Integer . MAX_VALUE ) { throw new IllegalStateException ( "The selector (" + this + ") has a childValueSelector (" + childValueSelector + ") with childSize (" + childSize + ") which is higher than Integer.MAX_VALUE." ) ; } cachedValueList = new ArrayList <> ( ( int ) childSize ) ; // TODO Fail-faster if a non FromSolutionPropertyValueSelector is used childValueSelector . iterator ( ) . forEachRemaining ( cachedValueList :: add ) ; logger . trace ( "    Created cachedValueList: size ({}), valueSelector ({})." , cachedValueList . size ( ) , this ) ; }
************************************************************************
************************************************************************