ReadonlyOrderedSet<T> Class

A read-only equivalent of Set<T> that maintains its elements in sorted order as specified by a comparison function. Iteration returns elements in the order specified by the comparison function, as opposed to Set which returns elements in insertion order. Implemented in terms of SortedArray.

Extended by

Implements

  • Iterable<T>

Methods

Name Description
constructor<T>(compare: OrderedComparator<T, T>, clone: CloneFunction<T> = shallowClone): ReadonlyOrderedSet<T> Construct a new ReadonlyOrderedSet.  
[iterator](): Iterator<T, any, undefined> Iterate over the elements in sorted order (as opposed to Set's iterator, which returns elements in insertion order).  
has(value: T): boolean Returns true if value is present in the set.  

Properties

Name Type Description
_array ProtectedReadonly SortedArray<T>    
size Accessor ReadOnly number The number of elements in the set.  

Defined in

Last Updated: 30 November, 2023