Constructors
constructor
- new SortedArray<T>(array?, comparator): SortedArray<T>
Parameters
- array: T[] = []
- comparator: ((a: T, b: T) => number)
- (a, b): number
Returns number
Properties
Readonly
comparator
comparator: ((a: T,
b: T) => number) Accessors
length
- get length(): number
Returns number
Methods
clear
- clear(): void
Returns void
find
- find(item): null | T
Returns null | T
includes
- includes(item): boolean
Returns boolean
index
- index(item, closest?): number
Parameters
- item: T
- closest: boolean = false
Returns number
insert
- insert(item): number
Returns number
remove
- remove(item): void
Returns void
Array that adds elements in sorted order.
Comparator is always called like: comparator(itemFromSortedArray, yourItem)