cloudsim-plus-master/cloudsim-plus-master/cloudsim-plus/src/main/java/org/cloudbus/cloudsim/schedulers/vm/VmSchedulerAbstract.java
protected <T> int removePesFromMap(Vm vm, Map<Vm, List<T>> map, int pesToRemove) {
        final List<T> values = map.getOrDefault(vm, new ArrayList<>());
        if(values.isEmpty()){
            return 0;
        }

        pesToRemove = Math.min((int)vm.getNumberOfPes(), pesToRemove);
        pesToRemove = Math.min(pesToRemove, values.size());
        IntStream.range(0, pesToRemove).forEach(i -> values.remove(0));
        if(values.isEmpty()){
            map.remove(vm);
        }

        return pesToRemove;
    }
/**
     * Remove a given number of PEs from a given {@code Vm -> List<PE>} Map,
     * where each PE in the List associated to each Vm may be an actual
     * {@link Pe} object or just its capacity in MIPS (Double).
     *
     * <p>In other words, the map can be {@code Map<Vm, List<Double>>}
     * or {@code Map<Vm, List<Pe>>}.</p>
     *
     * @param <T> the type of the elements into the List associated to each map key,
     *            which can be a MIPS number (Double) or an actual {@link Pe} object.
     * @param vm the VM to remove PEs from
     * @param map the map where the PEs will be removed
     * @param pesToRemove the number of PEs to remove from the List of PEs associated to the Vm
     * @return the number of removed PEs
     */
Remove a given number of PEs from a given  Vm -> List Map,
where each PE in the List associated to each Vm may be an actual
Pe object or just its capacity in MIPS (Double).

In other words, the map can be  Map>
or  Map>.

@param  the type of the elements into the List associated to each map key,
which can be a MIPS number (Double) or an actual  Pe object.
@param vm the VM to remove PEs from
@param map the map where the PEs will be removed
@param pesToRemove the number of PEs to remove from the List of PEs associated to the Vm
@return the number of removed PEs
Remove a given number of PEs from a given Vm - > List Map where each PE in the List associated to each Vm may be an actual Pe object or just its capacity in MIPS ( Double ) . In other words the map can be Map > or Map > . @param the type of the elements into the List associated to each map key which can be a MIPS number ( Double ) or an actual Pe object . @param vm the VM to remove PEs from @param map the map where the PEs will be removed @param pesToRemove the number of PEs to remove from the List of PEs associated to the Vm @return the number of removed PEs
protected <T> int removePesFromMap(Vm vm, Map<Vm, List<T>> map, int pesToRemove) {
        final List<T> values = map.getOrDefault(vm, new ArrayList<>());
        if(values.isEmpty()){
            return 0;
        }
        pesToRemove = Math.min((int)vm.getNumberOfPes(), pesToRemove);
        pesToRemove = Math.min(pesToRemove, values.size());
        IntStream.range(0, pesToRemove).forEach(i -> values.remove(0));
        if(values.isEmpty()){
            map.remove(vm);
        }
        return pesToRemove;
    }
protected < T > int removePesFromMap ( Vm vm , Map < Vm , List < T > > map , int pesToRemove ) { final List < T > values = map . getOrDefault ( vm , new ArrayList < > ( ) ) ; if ( values . isEmpty ( ) ) { return 0 ; } pesToRemove = Math . min ( ( int ) vm . getNumberOfPes ( ) , pesToRemove ) ; pesToRemove = Math . min ( pesToRemove , values . size ( ) ) ; IntStream . range ( 0 , pesToRemove ) . forEach ( i -> values . remove ( 0 ) ) ; if ( values . isEmpty ( ) ) { map . remove ( vm ) ; } return pesToRemove ; }
Remove a given number of PEs from a given {@code Vm -> List<PE>} Map,
 where each PE in the List associated to each Vm may be an actual
 {@link Pe} object or just its capacity in MIPS (Double).
Remove a given number of PEs from a given { @code Vm - > List<PE > } Map where each PE in the List associated to each Vm may be an actual { @link Pe } object or just its capacity in MIPS ( Double ) .