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.
Insert given element to the sorted set EVEN IF it's already present.
Putting another value that's equal via comparator will replace the current one.
Return a regular array that's a copy of this one.
Optionalstart: numberOptionalend: numberStaticfromCreate SortedSet from array that is not sorted. This function sorts the array. Duplicates are removed.
StaticfromCreate SortedSet from array that is not sorted. This function sorts the array. Duplicates are detected an are not allowed.
StaticfromCreate SortedSet from array that is sorted using given comparator.
NOTE: This function does not sort the array. Unsorted array will throw an error.
StaticfromCreate a new SortedSet from two sorted collections.
Collection of elements of type
Vthat has some strict ordering and does not have duplicates.The items are stored sorted, which allows logarithmic insertion & lookup and obviously in-order iteration.
Duplicates are not allowed. Inserting an existing item is no-op.