Skip to main content

interface SortedSet.NonEmpty<T>

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

Type parameters​

NameDescription
Tthe value type
note
  • The SortedSet keeps the inserted values in sorted order according to the context's comp Comp instance.
example
const s1 = SortedSet.empty<string>()
const s2 = SortedSet.of('a', 'b', 'c')

Methods​

max​

Returns the maximum value of the SortedSet.

Definition​

max(): T;

example
const m = SortedSet.of('b', 'd', 'a', 'c');
console.log(m.max())
// => 'd'

min​

Returns the minimum value of the SortedSet.

Definition​

min(): T;

example
const m = SortedSet.of('b', 'd', 'a', 'c');
console.log(m.min())
// => 'a'

stream​

undocumented

Definition​

stream(options?: {
      reversed?: boolean;
    }): Stream.NonEmpty<T>;

Parameters​

NameTypeDescription
options{
      reversed?: boolean;
    }

take​

undocumented

Definition​

take<N extends number>(amount: N): 0 extends N ? SortedSet<T> : SortedSet.NonEmpty<T>;

Type parameters​

NameConstraintsDescription
Nnumber

Parameters​

NameTypeDescription
amountN