Skip to main content

interface OrderedSortedSet<T>

A type-invariant immutable Ordered SortedSet of value type T. In the Set, there are no duplicate values. See the Set documentation and the OrderedSortedSet API documentation

Companion namespace: OrderedSortedSet

Extends: OrderedSetBase<T,Tp>

Implemented by: OrderedSortedSet.NonEmpty<T>

Type parameters

NameDescription
Tthe value type
note
  • The OrderedSortedSet keeps the insertion order of values, thus iterators and stream will also reflect this order.
    - The OrderedSortedSet wraps around a SortedSet instance, thus has the same time complexity as the SortedSet.
    - The OrderedSortedSet keeps the key insertion order in a List, thus its space complexity is higher than a regular SortedSet.
example
const s1 = OrderedSortedSet.empty<string>()
const s2 = OrderedSortedSet.of('a', 'b', 'c')

Properties

order

Returns a List instance containing the order of the elements.

Definition

readonly order: List<T>;

example
const s = OrderedHashSet.of('b', 'a', 'c')
console.log(s.order.toArray())
// => ['b', 'a', 'c']

Overrides

OrderedSetBase.order

sourceSet

Returns the contained Set instance.

Definition

readonly sourceSet: WithElem<Tp, T>['sourceSet'];

example
const s = OrderedHashSet.of('b', 'a', 'c')
console.log(m.sourceSet.toString())
// => HashSet('a', 'b', 'c')

Overrides

OrderedSetBase.sourceSet