Class ArrayInPlaceMergeSorter<T>

    • Field Detail

      • arr

        private final T[] arr
      • comparator

        private final java.util.Comparator<? super T> comparator
    • Constructor Detail

      • ArrayInPlaceMergeSorter

        public ArrayInPlaceMergeSorter​(T[] arr,
                                       java.util.Comparator<? super T> comparator)
    • Method Detail

      • compare

        protected int compare​(int i,
                              int j)
        Description copied from class: Sorter
        Compare entries found in slots i and j. The contract for the returned value is the same as Comparator.compare(Object, Object).
        Specified by:
        compare in class Sorter
      • swap

        protected void swap​(int i,
                            int j)
        Description copied from class: Sorter
        Swap values at slots i and j.
        Specified by:
        swap in class Sorter