Class DualPivotQuickSort


  • public class DualPivotQuickSort
    extends java.lang.Object
    Implementation of the Dual Pivot Quick Sort algorithm, based on the paper by Vladimir Yaroslavskiy, available at DualPivotQuicksort.pdf. This provides an in-place sorting mechanism, to allow the reuse of arrays containing a large number of objects, reducing the number of temporary object created by the Alfresco Solr indexing service.
    Author:
    Alex Miller
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <T> void sort​(T[] elements, int left, int right, java.util.Comparator<T> comparator)
      Sort elements between index left and index right, using comparator.
      static <T> void sort​(T[] elements, java.util.Comparator<T> comparator)
      Sort elements using comparator, in place.
      • Methods inherited from class java.lang.Object

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

      • DualPivotQuickSort

        public DualPivotQuickSort()
    • Method Detail

      • sort

        public static <T> void sort​(T[] elements,
                                    java.util.Comparator<T> comparator)
        Sort elements using comparator, in place.
      • sort

        public static <T> void sort​(T[] elements,
                                    int left,
                                    int right,
                                    java.util.Comparator<T> comparator)
        Sort elements between index left and index right, using comparator.