class OrderedSetBuilder<T,Tp,TpG>
undocumented
Implements: OrderedSetBase.Builder<T,Tp>
Type parameters
| Name | Constraints | Default | Description |
|---|---|---|---|
| T | undocumented | ||
| Tp | OrderedSetTypes | OrderedSetTypes | undocumented |
| TpG | WithElem<Tp, T> | WithElem<Tp, T> | undocumented |
Properties
_orderBuilder
undocumented
_orderBuilderDefinition
_orderBuilder?: List.Builder<T>;
addAll
undocumented
addAllDefinition
addAll: (source: StreamSource<T>) => boolean;
forEach
undocumented
forEachDefinition
forEach: (f: (value: T, index: number, halt: () => void) => void, options?: {
reversed?: boolean;
state?: TraverseState;
}) => void;
isEmpty
undocumented
isEmptyorderBuilder
undocumented
orderBuilderDefinition
get orderBuilder(): List.Builder<T>;
removeAll
undocumented
removeAllDefinition
removeAll: <U>(values: StreamSource<RelatedTo<T, U>>) => boolean;
size
undocumented
sizeMethods
add
Adds given value to the builder.
addvalue to the builder.addAll
Adds the values in given values StreamSource to the builder.
addAllvalues StreamSource to the builder.Definition
addAll(values: StreamSource<T>): boolean;
Parameters
| Name | Type | Description |
|---|---|---|
values | StreamSource<T> |
const s = HashSet.of(1, 2, 3).toBuilder()
s.addAll([1, 3]) // => false
s.addAll([2, 10]) // => true
Overrides
build
Returns an immutable instance containing the values in this builder.
buildforEach
Performs given function f for each value of the builder.
forEachf for each value of the builder.Definition
forEach(f: (value: T, index: number, halt: () => void) => void, options?: {
state?: TraverseState;
}): void;
Parameters
| Name | Type | Description |
|---|---|---|
f | (value: T, index: number, halt: () => void) => void | the 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 |
options | {state?: TraverseState;} | (optional) an object containing the following properties: - state: (optional) the traversal state |
RibuError.ModifiedBuilderWhileLoopingOverItError if the builder is modified while looping over it
HashSet.of(1, 2, 3).toBuilder.forEach((value, i, halt) => {
console.log([value, i]);
if (i >= 1) halt();
})
// => logs [1, 0] [2, 1]
O(N)
Overrides
has
Returns true if the given value is present in the builder.
hasvalue is present in the builder.remove
Remove the given value from the builder.
removevalue from the builder.removeAll
Removes the values in given values StreamSource from this builder.
removeAllvalues StreamSource from this builder.Definition
removeAll<U = T>(values: StreamSource<RelatedTo<T, U>>): boolean;
Type parameters
| Name | Default | Description |
|---|---|---|
| U | T |
Parameters
| Name | Type | Description |
|---|---|---|
values | StreamSource<RelatedTo<T, U>> | a StreamSource of values |
const s = HashSet.of(1, 2, 3).toBuilder()
s.removeAll([1, 3]) // => false
s.removeAll([2, 10]) // => true