Set¶
Import: import system.collections;
Set¶
A generic open-addressing hash set.
constructor¶
Allocates an empty set with an initial capacity (defaults to 8, rounded up to power of 2).
reserve¶
Reserves additional live entries, accounting for load factor and reclaiming tombstones.
length¶
Number of elements currently stored.
capacity¶
Current capacity of the backing buffer.
add¶
Inserts a value into the set. Returns true if it was newly added, false if already present.
contains¶
True if the set contains the value.
contains¶
True when the set holds the string equal to value, without building a string.
add_all¶
Adds every element of items, ignoring duplicates.
constructor¶
Creates a set containing the distinct elements of items. Set literals such as {1, 2, 3} create sets in the same way.
remove¶
Removes a value and returns true if it was removed.
remove¶
Removes value; returns whether it was present.
is_empty¶
True if the set is empty.
clear¶
Removes all elements, keeping the current capacity. Occupied key slots are zeroed so managed entries release; probe states are reset in place (no capacity realloc).
clear¶
Removes all entries while keeping storage for reuse.
to_array¶
Gets all elements as an array.
union¶
Elements present in this set or other.
intersection¶
Elements present in both sets.
difference¶
Elements in this set but not in other.
is_subset¶
True when every element of this set is in other.
is_disjoint¶
True when the sets share no elements.
iterator¶
Gets an iterator for the set.
to_string¶
Returns a text representation of this value.