Package org.optaplanner.core.impl.heuristic.selector.common.decorator

## Class ComparatorSelectionSorter<Solution_,​T>

- java.lang.Object
- - org.optaplanner.core.impl.heuristic.selector.common.decorator.ComparatorSelectionSorter<Solution_,​T>

- Type Parameters:
    `Solution_` - the solution type, the class with the `PlanningSolution` annotation
    `T` - the selection type
  All Implemented Interfaces:
    `SelectionSorter<Solution_,​T>`

      public class ComparatorSelectionSorter<Solution_,​T>
      extends Object
      implements SelectionSorter<Solution_,​T>

  Sorts a selection `List` based on a `Comparator`.

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `ComparatorSelectionSorter​(Comparator<T> comparator)` |
    `ComparatorSelectionSorter​(Comparator<T> comparator, SelectionSorterOrder selectionSorterOrder)` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `sort​(ScoreDirector<Solution_> scoreDirector, List<T> selectionList)` |

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### ComparatorSelectionSorter

          public ComparatorSelectionSorter​(Comparator<T> comparator)

    - #### ComparatorSelectionSorter

          public ComparatorSelectionSorter​(Comparator<T> comparator,
                                           SelectionSorterOrder selectionSorterOrder)

  - ### Method Detail

    - #### sort

          public void sort​(ScoreDirector<Solution_> scoreDirector,
                           List<T> selectionList)

      Specified by:
        `sort` in interface `SelectionSorter<Solution_,​T>`
      Parameters:
        `scoreDirector` - never null, the `ScoreDirector` which has the `ScoreDirector.getWorkingSolution()` to which the selections belong or apply to
        `selectionList` - never null, a `List` of `PlanningEntity`, planningValue, `Move` or `Selector`