Skip to main content

class OrderedSetBuilder<T,Tp,TpG>

undocumented

Implements: OrderedSetBase.Builder<T,Tp>

Type parameters

NameConstraintsDefaultDescription
Tundocumented
TpOrderedSetTypes OrderedSetTypesundocumented
TpGWithElem<Tp, T> WithElem<Tp, T>undocumented

Properties

_lock

undocumented

Definition

_lock: number;

_orderBuilder

undocumented

Definition

_orderBuilder?: List.Builder<T>;

_setBuilder

undocumented

Definition

_setBuilder?: TpG['sourceBuilder'];

add

undocumented

Definition

add: (value: T) => boolean;

addAll

undocumented

Definition

addAll: (source: StreamSource<T>) => boolean;

build

undocumented

Definition

build: () => TpG['normal'];

context

undocumented

Definition

readonly context: TpG['context'];

forEach

undocumented

Definition

forEach: (f: (value: T, index: number, halt: () => void) => void, state?: TraverseState) => void;

has

undocumented

Definition

has: <U>(value: RelatedTo<T, U>) => boolean;

isEmpty

undocumented

Definition

get isEmpty(): boolean;

Overrides

Builder.isEmpty

orderBuilder

undocumented

Definition

get orderBuilder(): List.Builder<T>;

remove

undocumented

Definition

remove: <U>(value: RelatedTo<T, U>) => boolean;

removeAll

undocumented

Definition

removeAll: <U>(values: StreamSource<RelatedTo<T, U>>) => boolean;

setBuilder

undocumented

Definition

get setBuilder(): TpG['sourceBuilder'];

size

undocumented

Definition

get size(): number;

Overrides

Builder.size

source

undocumented

Definition

source?: TpG["nonEmpty"] | undefined;

Methods

add

Adds given value to the builder.

Definition

add(value: T): boolean;

Parameters

NameTypeDescription
valueT
example
const s = HashSet.of(1, 2, 3).toBuilder()
s.add(2) // => false
s.add(10) // => true

Overrides

Builder.add

addAll

Adds the values in given values StreamSource to the builder.

Definition

addAll(values: StreamSource<T>): boolean;

Parameters

NameTypeDescription
valuesStreamSource<T>
example
const s = HashSet.of(1, 2, 3).toBuilder()
s.addAll([1, 3]) // => false
s.addAll([2, 10]) // => true

Overrides

Builder.addAll

build

Returns an immutable instance containing the values in this builder.

Definition

build(): WithElem<Tp, T>['normal'];

example
const s = HashSet.of(1, 2, 3).toBuilder()
const s2: HashSet<number> = m.build()

Overrides

Builder.build

checkLock

undocumented

Definition

checkLock(): void;

forEach

Performs given function f for each value of the builder.

Definition

forEach(f: (value: T, index: number, halt: () => void) => void, state?: TraverseState): void;

Parameters

NameTypeDescription
f(value: T, index: number, halt: () => void) => voidthe function to perform for each element, receiving:
- value: the next element
- index: the index of the element
- halt: a function that, if called, ensures that no new elements are passed
stateTraverseState
throws

RibuError.ModifiedBuilderWhileLoopingOverItError if the builder is modified while looping over it

example
HashSet.of(1, 2, 3).toBuilder.forEach((value, i, halt) => {
console.log([value, i]);
if (i >= 1) halt();
})
// => logs [1, 0] [2, 1]
note

O(N)

Overrides

Builder.forEach

has

Returns true if the given value is present in the builder.

Definition

has<U = T>(value: RelatedTo<T, U>): boolean;

Type parameters

NameDefaultDescription
UT

Parameters

NameTypeDescription
valueRelatedTo<T, U>the value to look for
example
const s = HashSet.of(1, 2, 3).toBuilder()
s.has(2) // => true
s.has(10) // => false

Overrides

Builder.has

prepareMutate

undocumented

Definition

prepareMutate(): void;

remove

Remove the given value from the builder.

Definition

remove<U = T>(value: RelatedTo<T, U>): boolean;

Type parameters

NameDefaultDescription
UT

Parameters

NameTypeDescription
valueRelatedTo<T, U>
example
const s = HashSet.of(1, 2, 3).toBuilder()
s.remove(10) // => false
s.remove(2) // => true

Overrides

Builder.remove

removeAll

Removes the values in given values StreamSource from this builder.

Definition

removeAll<U = T>(values: StreamSource<RelatedTo<T, U>>): boolean;

Type parameters

NameDefaultDescription
UT

Parameters

NameTypeDescription
valuesStreamSource<RelatedTo<T, U>>a StreamSource of values
example
const s = HashSet.of(1, 2, 3).toBuilder()
s.removeAll([1, 3]) // => false
s.removeAll([2, 10]) // => true

Overrides

Builder.removeAll