Class Sorter.QuickSorter<T>

java.lang.Object
com.complexible.common.base.Sorter<T>
com.complexible.common.base.Sorter.QuickSorter<T>
Enclosing class:
Sorter<T>

public static final class Sorter.QuickSorter<T> extends Sorter<T>
Sorter implementation for QuickSort. This is basically a fork of the mahout, in-place quick-sort with a couple minor modifications
  • Nested Class Summary

    Nested classes/interfaces inherited from class com.complexible.common.base.Sorter

    Sorter.QuickSorter<T>
  • Field Summary

    Fields inherited from class com.complexible.common.base.Sorter

    c
  • Constructor Summary

    Constructors
    Constructor
    Description
    QuickSorter(Comparator<? super T> c)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static <T extends Comparable<? super T>>
    void
    quickSort(T[] array, int start, int end)
    Sort the specified range of an array of object that implement the Comparable interface.
    static <T> void
    quickSort(T[] array, int start, int end, Comparator<T> comp)
    Sorts the specified range in the array in a specified order.
    void
    sort(T[] array, int start, int end)
     

    Methods inherited from class com.complexible.common.base.Sorter

    create

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • QuickSorter

      public QuickSorter(Comparator<? super T> c)
  • Method Details

    • sort

      public void sort(T[] array, int start, int end)
      Specified by:
      sort in class Sorter<T>
    • quickSort

      public static <T> void quickSort(T[] array, int start, int end, Comparator<T> comp)
      Sorts the specified range in the array in a specified order.
      Parameters:
      array - the array to be sorted.
      start - the start index to sort.
      end - the last + 1 index to sort.
      comp - the comparator.
      Throws:
      IllegalArgumentException - if start > end.
      ArrayIndexOutOfBoundsException - if start < 0 or end > array.length.
    • quickSort

      public static <T extends Comparable<? super T>> void quickSort(T[] array, int start, int end)
      Sort the specified range of an array of object that implement the Comparable interface.
      Type Parameters:
      T - The type of object.
      Parameters:
      array - the array.
      start - the first index.
      end - the last index (exclusive).