envzn
0.8 · beta · not released

Library / Collections / Sequences / Set

CLASSIMPLEMENTS Cloneable, Collection<V>

Set

Set is a thin pure-Envzn wrapper over a Dictionary

Fields 1

int64 length

Constructors 4

INIT()

No hasher — the backing dictionary CREATEs a DefaultHasher[V].

INIT(Hasher[V] h)

Caller-supplied hasher, threaded into the backing dictionary.

INIT(GrowthHint hint, int64 initialCapacity)

Default hasher + sizing hints (forwarded to the dictionary).

INIT(Hasher[V] h, GrowthHint hint, int64 initialCapacity)

Caller hasher + sizing hints.

Methods 12

METHOD clone() RETURNS Set[V, H]
reads

Deep copy — the backing dictionary clones every key.

METHOD iterator() RETURNS ReferenceIterator[V]
reads

ITERATOR — yields the elements (the dictionary's keys).

METHOD isEmpty() RETURNS boolean
reads
METHOD size() RETURNS int64
reads

Number of elements currently stored. Read-only, O(1).

MODIFY METHOD clear() RETURNS void
modifies
MODIFY METHOD add(V value) RETURNS STATUS
modifies

ADD / REMOVE / CONTAINS Add value (consumed). If already present, the element stays and the moved-in value is dropped; .length is unchanged.

MODIFY METHOD addCopy(REFERENCE V value) RETURNS STATUS
modifies

Deep-copy form of add. value stays valid for the caller.

METHOD contains(REFERENCE V value) RETURNS boolean
reads
MODIFY METHOD remove(REFERENCE V value) RETURNS STATUS
modifies

Remove value. SUCCESS if it was a member, FAILURE otherwise.

METHOD unionWith(REFERENCE Set[V, H] other) RETURNS Set[V, H]
reads

SET ALGEBRA — |+| / |&| / |-| bind to these. Union — every element from either input (deduped).

METHOD intersectionWith(REFERENCE Set[V, H] other) RETURNS Set[V, H]
reads

Intersection — elements present in BOTH inputs.

METHOD differenceWith(REFERENCE Set[V, H] other) RETURNS Set[V, H]
reads

Difference — elements in SELF but NOT in other (asymmetric).