Package org.uma.jmetal.util
Class ListUtils
java.lang.Object
org.uma.jmetal.util.ListUtils
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <S> booleanlistAreEquals(List<S> firstList, List<S> secondList) Compares two lists to determine if they are equalsstatic <S> List<S> randomSelectionWithoutReplacement(int numberOfElementsSelect, List<S> solutionList) Selects N random elements from a list without replacement.static <S> List<S> randomSelectionWithoutReplacement(int numberOfElementsToSelect, List<S> list, BoundedRandomGenerator<Integer> randomGenerator) Selects N random elements from a list without replacement.static <S> List<S> randomSelectionWithReplacement(int numberOfElementsSelect, List<S> solutionList) Selects N random elements from a list with replacement.static <S> List<S> randomSelectionWithReplacement(int numberOfElementsToSelect, List<S> list, BoundedRandomGenerator<Integer> randomGenerator) Selects N random elements from a list with replacement.
-
Constructor Details
-
ListUtils
public ListUtils()
-
-
Method Details
-
randomSelectionWithoutReplacement
-
randomSelectionWithoutReplacement
public static <S> List<S> randomSelectionWithoutReplacement(int numberOfElementsToSelect, List<S> list, BoundedRandomGenerator<Integer> randomGenerator) Selects N random elements from a list without replacement. The size of the list must be equal or higher than the number of elements to select.- Parameters:
list- The listrandomGenerator- The random number generator- Returns:
- The selected elements
-
randomSelectionWithReplacement
-
randomSelectionWithReplacement
public static <S> List<S> randomSelectionWithReplacement(int numberOfElementsToSelect, List<S> list, BoundedRandomGenerator<Integer> randomGenerator) Selects N random elements from a list with replacement. The size of the list can be smaller than the number of requested elements.- Parameters:
list- The listrandomGenerator- The random number generator- Returns:
- The selected elements
-
listAreEquals
-