Class ListUtils

java.lang.Object
org.uma.jmetal.util.ListUtils

public class ListUtils extends Object
  • Constructor Details

    • ListUtils

      public ListUtils()
  • Method Details

    • randomSelectionWithoutReplacement

      public static <S> List<S> randomSelectionWithoutReplacement(int numberOfElementsSelect, List<S> solutionList)
      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.
    • 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 list
      randomGenerator - The random number generator
      Returns:
      The selected elements
    • randomSelectionWithReplacement

      public static <S> List<S> randomSelectionWithReplacement(int numberOfElementsSelect, List<S> solutionList)
      Selects N random elements from a list with replacement. The size of the list can be smaller than the number of requested elements.
    • 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 list
      randomGenerator - The random number generator
      Returns:
      The selected elements
    • listAreEquals

      public static <S> boolean listAreEquals(List<S> firstList, List<S> secondList)
      Compares two lists to determine if they are equals
      Parameters:
      firstList - A list
      secondList - A list
      Returns:
      true if both lists contain the same elements (in any order), false in other case