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>, clone: CloneFunction<T>shallowClone): ReadonlyOrderedSet<T> Construct a new ReadonlyOrderedSet.  
[iterator](): Iterator<T, any, any> 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 Protected Readonly SortedArray<T>    
size Accessor ReadOnly number The number of elements in the set.  

Defined in

Last Updated: 23 November, 2024