Skip to main content

interface OrderedSet<T>

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

Companion namespace: OrderedSet

Implemented by: OrderedSet.NonEmpty<T>

Type parameters

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