The std/set module provides a Generic Hash Set Set<T>.
import "std/set.zc"
A set of unique elements.
-
fn new() -> Set<T>Creates a new empty set. -
fn add(self, val: T) -> boolAdds a value to the set. Returnstrueif the value was added,falseif it was already present. -
fn contains(self, val: T) -> boolReturnstrueif the set contains the value. -
fn remove(self, val: T) -> boolRemoves a value from the set. Returnstrueif present and removed. -
fn length(self) -> usizeReturns the number of elements in the set. -
fn is_empty(self) -> boolReturnstrueif the set is empty. -
fn clear(self)Removes all elements from the set.