it allows to use SortedArray in for-of loop
ProtectedbinaryReturn the exact (in terms of comparator) element that's in the array if present.
Note this API might look redundant on a first glance, but it really depends on the comparator. We might have a complex object inside the array, yet the comparator will consider two objects equal just by looking at the id. With this API we are able to retrieve the exact object that's stored.
Returns index of SOME (it's not guaranteed it's first or last) equal element or -1 if the element does not exist.
Return and remove the last element of the collection.
shift is much slower, so please don't add it.
Return a regular array that's a copy of this one.
Optionalstart: numberOptionalend: numberStaticfromCreate SortedArray from array that is not sorted. This function sorts the array.
StaticfromCreate SortedArray from array that is sorted. This function does not sort the array. Unsorted array will not work correctly!
StaticfromCreate a new SortedArray from two sorted collections.
Collection of elements of type
Vthat has some strict ordering.The items are stored sorted, which allows logarithmic insertion & lookup and obviously in-order iteration.
Duplicates are allowed, so make sure to check presence before inserting.