public class SortUtils
extends java.lang.Object
| Constructor and Description |
|---|
SortUtils() |
| Modifier and Type | Method and Description |
|---|---|
static int |
binarySearch(java.util.function.Function<java.lang.Integer,java.lang.Long> valueProvider,
int absoluteMax,
long insertionValue,
boolean randomAccessList)
A faster binary search algorithm for sorting a list.
|
static int |
binarySearch(java.util.List<java.lang.Long> values,
long insertionValue,
boolean randomAccessList)
A faster binary search algorithm for sorting a list.
|
static int |
getInsertionEndIndex(java.util.function.Function<java.lang.Integer,java.lang.Long> valueProvider,
int absoluteMax,
long insertionValue,
boolean randomAccessList)
This function uses the binary search and adds a small amount of logic such that it determines
the placement index for a given value.
|
static int |
getInsertionEndIndex(java.util.List<java.lang.Long> values,
long insertionValue,
boolean randomAccessList)
This function uses the binary search and adds a small amount of logic such that it determines
the placement index for a given item.
|
public static int getInsertionEndIndex(java.util.List<java.lang.Long> values,
long insertionValue,
boolean randomAccessList)
values - List of values to search over and find desired valueinsertionValue - value in relation to functions provided values to search for insertion pointrandomAccessList - boolean for optimization with binary searchpublic static int getInsertionEndIndex(java.util.function.Function<java.lang.Integer,java.lang.Long> valueProvider,
int absoluteMax,
long insertionValue,
boolean randomAccessList)
valueProvider - Function which will provide values for requested indexesabsoluteMax - maximum index (inclusive) to search withininsertionValue - value in relation to functions provided values to search for insertion pointrandomAccessList - boolean for optimization with binary searchpublic static int binarySearch(java.util.List<java.lang.Long> values,
long insertionValue,
boolean randomAccessList)
values - List of values to search over and find desired valueinsertionValue - value in relation to functions provided values to search for insertion pointrandomAccessList - true to optimize for list that have cheap random accesspublic static int binarySearch(java.util.function.Function<java.lang.Integer,java.lang.Long> valueProvider,
int absoluteMax,
long insertionValue,
boolean randomAccessList)
valueProvider - Function which will provide values for requested indexesabsoluteMax - maximum index (inclusive) to search withininsertionValue - value in relation to functions provided values to search for insertion pointrandomAccessList - true to optimize for list that have cheap random access