Package com.complexible.common.base

# Class Sorter<T>

java.lang.Object
com.complexible.common.base.Sorter<T>

Direct Known Subclasses:
  `Sorter.QuickSorter`

public abstract class Sorter<T> extends Object
This class performs merge sort over an array but allocates the additional array used in merge sort upfront so if the arrays of same size will be sorted repeatedly this sorter can be reused to minimize garbage collection with the price of having memory for extra array always being used.

Author:
  Evren Sirin

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static final class`
  `Sorter.QuickSorter<T>`
  Sorter implementation for QuickSort.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected final Comparator<? super T>`
  `c`

- ## Constructor Summary

  Constructors
  Modifier
  Constructor
  Description
  `protected`
  `Sorter(Comparator<? super T> c)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static <T> Sorter<T>`
  `create(int length, Comparator<? super T> comp)`
  `abstract void`
  `sort(T[] array, int start, int end)`

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

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

- ## Field Details

  - ### c

    protected final Comparator<? super T> c

- ## Constructor Details

  - ### Sorter

    protected Sorter(Comparator<? super T> c)

- ## Method Details

  - ### create

    public static <T> Sorter<T> create(int length, Comparator<? super T> comp)

  - ### sort

    public abstract void sort(T[] array, int start, int end)