Divooka Reference

Set Routines

19 nodes

On this page 19

Add

Function

This node carries no documentation.

Signature
Add(set: Set of T, item: T) -> Truth
bool Add(HashSet<T> set, T item)

Parameters

nametypedefaultdescription
setSet of T—
itemT—

Returns

resultTruth
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Set Routines
Package
Standard Library

Clear

Function

Removes every element from the set, in place; the set itself stays usable and keeps its equality rule.

Signature
Clear(set: Set of T)
void Clear(HashSet<T> set)

Parameters

nametypedefaultdescription
setSet of T—The set to empty.
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Set Routines
Package
Standard Library

Clone

Function

An independent copy of the set with the same elements and the same equality rule, so that changing one does not change the other. The elements themselves are shared, not copied.

Signature
Clone(set: Set of T) -> Set of T
HashSet<T> Clone(HashSet<T> set)

Parameters

nametypedefaultdescription
setSet of T—The set to copy.

Returns

resultSet of T
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Set Routines
Package
Standard Library

Comparer

Function

The equality rule the set uses to decide which elements are the same, for creating another set that behaves alike.

Signature
Comparer(set: Set of T) -> IEqualityComparer<T>
IEqualityComparer<T> Comparer(HashSet<T> set)

Parameters

nametypedefaultdescription
setSet of T—The set to inspect.

Returns

resultIEqualityComparer<T>
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Set Routines
Package
Standard Library

Contains

Function

Whether the set holds an element equal to Item, by the set's own equality rule; this is a fast lookup, however large the set.

Signature
Contains(set: Set of T, item: T) -> Truth
bool Contains(HashSet<T> set, T item)

Parameters

nametypedefaultdescription
setSet of T—The set to search.
itemT—The element to look for.

Returns

resultTruth
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Set Routines
Package
Standard Library

Count

Function

How many elements the set holds.

Signature
Count(set: Set of T) -> Integer
int Count(HashSet<T> set)

Parameters

nametypedefaultdescription
setSet of T—The set to measure.

Returns

resultInteger
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Set Routines
Package
Standard Library

Create

Function

Overload 1 of 5

Signature
Create() -> Set of T
HashSet<T> Create()

A new, empty set that compares its elements by their default equality.

Returns

resultSet of T

Overload 2 of 5

Signature
Create(capacity: Integer) -> Set of T
HashSet<T> Create(int capacity)

A new, empty set with room for Capacity elements before it has to grow, for when the final size is known in advance. Throws System.ArgumentOutOfRangeException when Capacity is negative.

Parameters

nametypedefaultdescription
capacityInteger—How many elements to make room for.

Returns

resultSet of T

Overload 3 of 5

Signature
Create(comparer: IEqualityComparer<T>) -> Set of T
HashSet<T> Create(IEqualityComparer<T> comparer)

A new, empty set that uses Comparer to decide which elements are the same, for example text compared without regard to case.

Parameters

nametypedefaultdescription
comparerIEqualityComparer<T>—Decides whether two elements are equal; null uses the default equality.

Returns

resultSet of T

Overload 4 of 5

Signature
Create(source: IEnumerable<T>) -> Set of T
HashSet<T> Create(IEnumerable<T> source)

A new set holding the elements of a sequence, with duplicates dropped, compared by their default equality.

Parameters

nametypedefaultdescription
sourceIEnumerable<T>—The elements to put in the set.

Returns

resultSet of T

Overload 5 of 5

Signature
Create -> Set of T
    source: IEnumerable<T>
    comparer: IEqualityComparer<T>
HashSet<T> Create(
    IEnumerable<T> source,
    IEqualityComparer<T> comparer)

A new set holding the elements of a sequence, with Comparer deciding which ones are duplicates; the set keeps using it afterwards.

Parameters

nametypedefaultdescription
sourceIEnumerable<T>—The elements to put in the set.
comparerIEqualityComparer<T>—Decides whether two elements are equal; null uses the default equality.

Returns

resultSet of T
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Set Routines
Package
Standard Library

Except

Function

The first operand's elements minus the second's, in a new set; both operands untouched.

Signature
Except(set: Set of T, other: IEnumerable<T>) -> Set of T
HashSet<T> Except(HashSet<T> set, IEnumerable<T> other)

Parameters

nametypedefaultdescription
setSet of T—
otherIEnumerable<T>—

Returns

resultSet of T
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Set Routines
Package
Standard Library

Intersect

Function

Only the elements both operands have, in a new set; both operands untouched.

Signature
Intersect(set: Set of T, other: IEnumerable<T>) -> Set of T
HashSet<T> Intersect(HashSet<T> set, IEnumerable<T> other)

Parameters

nametypedefaultdescription
setSet of T—
otherIEnumerable<T>—

Returns

resultSet of T
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Set Routines
Package
Standard Library

Is Empty

Function

Whether the set holds no elements.

Signature
IsEmpty(set: Set of T) -> Truth
bool IsEmpty(HashSet<T> set)

Parameters

nametypedefaultdescription
setSet of T—The set to test.

Returns

resultTruth
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Set Routines
Package
Standard Library

Is Subset Of

Function

Whether every element of Set is also in Other, by the set's equality rule. An empty set is a subset of anything, and a set is a subset of itself.

Signature
IsSubsetOf(set: Set of T, other: IEnumerable<T>) -> Truth
bool IsSubsetOf(HashSet<T> set, IEnumerable<T> other)

Parameters

nametypedefaultdescription
setSet of T—The set that should be contained.
otherIEnumerable<T>—The elements it should be contained in; duplicates and order do not matter.

Returns

resultTruth
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Set Routines
Package
Standard Library

Is Superset Of

Function

Whether every element of Other is also in Set, by the set's equality rule. Any set is a superset of an empty sequence.

Signature
IsSupersetOf(set: Set of T, other: IEnumerable<T>) -> Truth
bool IsSupersetOf(HashSet<T> set, IEnumerable<T> other)

Parameters

nametypedefaultdescription
setSet of T—The set that should contain the elements.
otherIEnumerable<T>—The elements it should contain; duplicates and order do not matter.

Returns

resultTruth
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Set Routines
Package
Standard Library

Overlaps

Function

Whether the set and the other elements have at least one element in common, by the set's equality rule; false when either is empty.

Signature
Overlaps(set: Set of T, other: IEnumerable<T>) -> Truth
bool Overlaps(HashSet<T> set, IEnumerable<T> other)

Parameters

nametypedefaultdescription
setSet of T—The set to test.
otherIEnumerable<T>—The elements to look for in the set.

Returns

resultTruth
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Set Routines
Package
Standard Library

Remove

Function

This node carries no documentation.

Signature
Remove(set: Set of T, item: T) -> Truth
bool Remove(HashSet<T> set, T item)

Parameters

nametypedefaultdescription
setSet of T—
itemT—

Returns

resultTruth
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Set Routines
Package
Standard Library

Set Equals

Function

Whether the set and the other elements hold exactly the same elements, by the set's equality rule, ignoring order and any duplicates in Other.

Signature
SetEquals(set: Set of T, other: IEnumerable<T>) -> Truth
bool SetEquals(HashSet<T> set, IEnumerable<T> other)

Parameters

nametypedefaultdescription
setSet of T—The set to compare.
otherIEnumerable<T>—The elements to compare it with.

Returns

resultTruth
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Set Routines
Package
Standard Library

Symmetric Except

Function

The elements in exactly one of the two operands, in a new set; both operands untouched.

Signature
SymmetricExcept -> Set of T
    set: Set of T
    other: IEnumerable<T>
HashSet<T> SymmetricExcept(HashSet<T> set, IEnumerable<T> other)

Parameters

nametypedefaultdescription
setSet of T—
otherIEnumerable<T>—

Returns

resultSet of T
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Set Routines
Package
Standard Library

To Array

Function

Copies the set's elements into a new array, for when an indexed or ordered collection is needed. The order is whatever order the set happens to hold them in, which is not guaranteed to be insertion order.

Signature
ToArray(set: Set of T) -> T Array
T[] ToArray(HashSet<T> set)

Parameters

nametypedefaultdescription
setSet of T—The set to copy.

Returns

resultT Array
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Set Routines
Package
Standard Library

To List

Function

Copies the set's elements into a new list, for when an indexed collection that can hold duplicates is needed. The order is whatever order the set happens to hold them in, which is not guaranteed to be insertion order.

Signature
ToList(set: Set of T) -> List of T
List<T> ToList(HashSet<T> set)

Parameters

nametypedefaultdescription
setSet of T—The set to copy.

Returns

resultList of T
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Set Routines
Package
Standard Library

Union

Function

Every element in either operand, in a new set; both operands untouched.

Signature
Union(set: Set of T, other: IEnumerable<T>) -> Set of T
HashSet<T> Union(HashSet<T> set, IEnumerable<T> other)

Parameters

nametypedefaultdescription
setSet of T—
otherIEnumerable<T>—

Returns

resultSet of T
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Set Routines
Package
Standard Library