All types of utils only usable in a sorted array.
Static methods
View in GitHub
staticinlineaddSorted<T>(array:Array<T>, val:T, getVal:T ‑> Float):Void
Adds to a sorted array, using binary search.
Parameters:
array | Array to add to |
---|---|
val | Value to add |
getVal | Function that returns the value that needs to be sorted |
View in GitHub
staticinlinebinarySearch<T>(array:Array<T>, val:Float, getVal:T ‑> Float):Int
Gets the index of a possible new element of an Array of T using an efficient algorithm.
Parameters:
array | Array of T to check in |
---|---|
getVal | Function that returns the position value of T |
Returns:
Index