public class TimSort<T>
extends java.lang.Object
OrderedMap that allow sorting. In many cases those data structures expose methods like
OrderedSet.sort(Comparator) or OrderedMap.sortByValue(Comparator, int, int), and using those class'
methods is a much better idea than trying to use TimSort directly on a data structure that already allows sorting.
| Modifier and Type | Method and Description |
|---|---|
static <T> void |
sort(T[] a,
IntVLA order,
java.util.Comparator<? super T> c)
Modifies
order by comparing items in the array a with the Comparator c; not likely to be
used externally except by code that extends or re-implements SquidLib data structures. |
static <T> void |
sort(T[] a,
IntVLA order,
int lo,
int hi,
java.util.Comparator<? super T> c)
Modifies
order by comparing items from index lo inclusive to index hi exclusive in the
array a with the Comparator c; not likely to be used externally except by code that extends or
re-implements SquidLib data structures. |
public static <T> void sort(T[] a,
IntVLA order,
java.util.Comparator<? super T> c)
order by comparing items in the array a with the Comparator c; not likely to be
used externally except by code that extends or re-implements SquidLib data structures. Generally, order
is the OrderedMap.order field or some similar IntVLA used to keep order in an OrderedSet or the like; it
will be modified in-place, but the other parameters will be unchanged.T - the type of items in a that c can comparea - an array of T, where items will be compared using c; will not be modifiedorder - an IntVLA that stores indices in a in the order they would be iterated through; will be modifiedc - a Comparator that can compare items in apublic static <T> void sort(T[] a,
IntVLA order,
int lo,
int hi,
java.util.Comparator<? super T> c)
order by comparing items from index lo inclusive to index hi exclusive in the
array a with the Comparator c; not likely to be used externally except by code that extends or
re-implements SquidLib data structures. Generally, order is the OrderedMap.order field or some
similar IntVLA used to keep order in an OrderedSet or the like; it will be modified in-place, but the other
parameters will be unchanged.T - the type of items in a that c can comparea - an array of T, where items will be compared using c; will not be modifiedorder - an IntVLA that stores indices in a in the order they would be iterated through; will be modifiedlo - the inclusive start index to compare in a and change in orderhi - the exclusive end index to compare in a and change in orderc - a Comparator that can compare items in aCopyright © Eben Howard 2012–2022. All rights reserved.