Sorter

object Sorter(source)

Facade for the Kindling sort library.

Provides a unified entry point for all sorting algorithms, delegating to SortType for dispatch. Prefer this over calling algorithm objects directly when the sort strategy should be a runtime parameter.

Sorter.sort(array, SortType.INTRO)
Sorter.sort(array, SortType.MERGE, compareByDescending { it.name })
Sorter.sort(intArray, SortType.RADIX)

Functions

Link copied to clipboard
fun <T : Comparable<T>> sort(array: Array<T>, type: SortType)

Sorts array in ascending natural order using the given type.

fun sort(array: IntArray, type: SortType)

Sorts array in ascending order using the given type.

fun <T> sort(array: Array<T>, type: SortType, comparator: Comparator<T>)

Sorts array using the given comparator and type.