Initialize a sorted container instance.
Optional iterable argument provides an initial iterable of values to initialize the sorted container.
Optionaliterable: Iterable<T, any, any>Initial values (optional).
Optionaloptions: SortedArrayConstructorOptions<C>An object that specifies characteristics about the sorted container.
StaticDEFAULT_The default load factor.
Override it with option loadFactor at construction time.
Return the size of the SortedSet.
The size of the SortedSet.
Return an iterator over the sorted container.
Iterating a sorted container while adding or deleting elements may throw an error or silently fail to iterate over all elements.
Add value to SortedSet if it does not already exist.
Value to add to the SortedSet.
Lookup value at index in sorted container.
If index is out of range, returns undefined.
The zero-based index of the desired code unit. A negative index will count back from the last item.
The item located at the specified index, or undefined if index out of range.
Return an index to insert value in the sorted container.
If the value is already present, the insertion point will be before (to the left of) any existing values.
Value to find the insertion point of.
Insertion index of value in the sorted container.
Return an index to insert value in the sorted container.
Similar to bisectLeft, but if value is already present, the insertion point will be after (to the right of) any existing values.
Value to find the insertion point of.
Insertion index of value in the sorted container.
Remove all values from sorted container.
Return a shallow copy of the sorted container.
A new sorted container.
Return number of occurrences of value in the SortedSet.
Value to count in the SortedSet.
Count.
Remove one value from sorted container if it is a member.
If value is not a member, do nothing.
Value to discard from SortedArray.
Returns true if an element in the SortedArray existed and has been removed, or false if the element does not exist.
Remove and return value at index in sorted container.
If the sorted container is empty or index is out of range, undefined is returned and the sorted container is not modified.
Negative indices count back from the last item.
Index of value. Negative integers count back from the last item in the array.
The removed value or undefined.
Removes elements from sorted container by index.
The zero-based location in the array from which to start removing elements. Negative integers count back from the last item in the array.
The zero-based location in the array at which to stop removing elements.
Negative integers count back from the last item in the array.
Elements up to but not including end are removed.
Remove all values of an iterable from this SortedSet.
An iterable.
Return the first element in the sorted container that is equal to the provided value. If it is not found, undefined is returned.
With the default comparator and primitive elements, this method does not tell anything beyond whether the value exists in the sorted container. However, it can turn out to be useful with a custom comparator.
The value to find.
Return true if value is an element of the SortedSet.
Search for this value in the SortedSet.
true if value is in the SortedSet.
Return first index of value in the sorted container, or -1 if value is not present.
Index must be between start and end for the value to be considered present.
Negative indices count back from the last item.
Value in sorted container.
The array index at which to start the search. If omitted, defaults to 0.
The array index at which to end the search. If omitted, defaults to the end of the sorted container.
The index of the first occurrence of value in the sorted container, or -1 if it is not present.
Update the sorted set with the intersection of two sets.
Keep only values found in itself and other.
An iterable.
Create an iterator of values between minimum and maximum.
Both minimum and maximum default to undefined which is automatically inclusive of the beginning and end of the sorted container.
The argument includeMinimum and includeMaximum is a pair of booleans that indicates whether the minimum and maximum ought to be included in the range, respectively.
Both arguments default to true such that the range is inclusive of both minimum and maximum.
When reverse is true the values are yielded from the iterator in reverse order; reverse defaults to false.
Iterating a sorted container while adding or deleting elements may throw an error or silently fail to iterate over all elements.
Optionalminimum: CMinimum value to start iterating.
Optionalmaximum: CMaximum value to stop iterating.
Whether the minimum ought to be included in the range.
Whether the maximum ought to be included in the range.
Whether to yield values in reverse order.
Iterator.
Check if this SortedSet has no elements in common with the given set.
An iterable.
true if this SortedSet has no elements in common with the other set, and false otherwise.
Return an iterator that slices sorted container from start to end.
The start and end index are treated inclusive and exclusive, respectively.
A negative index will count back from the last item.
Both start and end default to undefined which is automatically inclusive of the beginning and end of the sorted container.
When reverse is true the values are yielded from the iterator in reverse order; reverse defaults to false.
Iterating a sorted container while adding or deleting elements may throw an error or silently fail to iterate over all elements.
Start index (inclusive).
Stop index (exclusive).
Whether to yield values in reverse order.
Iterator.
Check if all elements of this SortedSet are in the given set.
An iterable.
true if all elements in this SortedSet are also in the other set, and false otherwise.
Check if all elements of the given set are in this SortedSet.
An iterable.
true if all elements in the other set are also in this SortedSet, and false otherwise.
Despite its name, returns an iterable of the values in the SortedSet.
Remove the last element from the sorted container and return it. If the sorted container is empty, undefined is returned and the sorted container is not modified.
Popped value or undefined.
Return a reverse iterator over the sorted container.
Iterating a sorted container while adding or deleting elements may throw an error or silently fail to iterate over all elements.
Remove the first element from the sorted container and return it. If the sorted container is empty, undefined is returned and the sorted container is not modified.
Shifted value or undefined.
Returns a copy of a section of sorted container as an ordinary Array.
For both start and end, a negative index can be used to indicate an offset from the end of the array.
The beginning index of the specified portion of the array. If start is undefined, then the slice begins at index 0.
The end index of the specified portion of the array. This is exclusive of the element at the index end.
If end is undefined, then the slice extends to the end of the array.
Update the sorted set with the symmetric difference with other.
Keep only values found in exactly one of itself and other.
An iterable.
Return sorted container as an ordinary Array.
Return a string representation of sorted container.
Return new SortedSet with values from itself and other.
An iterable. It does not have to be a Set-like.
The union as a new SortedSet.
const ss = new SortedSet([1, 2, 3, 4, 5]);
ss.union([4, 5, 6, 7, 5]) // SortedSet [1, 2, 3, 4, 5, 6, 7]
update for an in-place version of this method.
Returns an iterable of values in the SortedSet.
SortedSet is a sorted mutable set.
SortedSet values are maintained in sorted order. The design of SortedSet is simple: SortedSet is implemented as a SortedArray that prevents duplicates to be inserted. It does not use the native Set type at all.
SortedSet values must have a total ordering. They are compared using the provided comparator function only; they do not have to be the same object to be considered equal.
The total ordering of values must not change while they are stored in the SortedSet.
Set methods and properties:
SortedArray methods:
Set-operation methods:
Miscellaneous methods: