All Bundles

Set<K:Compare>

Ordered set of generic objects

Operations

Code example:

# insert elements
set := Collection.Set->New()<String>;
set->Insert("San Francisco");
set->Insert("Oakland");
set->Insert("East Bay");

# get size
set->Size()->PrintLine();

# get value by key
set->Has("Oakland")->PrintLine();

New

Default constructor

New()

Empty

Clears the set

method : public : Empty() ~ Nil

GetKeys

Get a collection of keys

method : public : GetKeys() ~ Vector<K>
Return
TypeDescription
Vector<K>vector of keys

Has

Checks for key in set

method : public : Has(key:K) ~ Bool
Parameters
NameTypeDescription
keyKsearch key

Return
TypeDescription
Booltrue if found, false otherwise

Insert

Inserts a key into the set

method : public : Insert(key:K) ~ Nil
Parameters
NameTypeDescription
keyKkey

IsEmpty

Checks to see if the set is empty

method : public : IsEmpty() ~ Bool
Return
TypeDescription
Booltrue if empty, false otherwise

Remove

Removes a key from the set

method : public : Remove(key:K) ~ Bool
Parameters
NameTypeDescription
keyKkey for value to remove

Return
TypeDescription
Booltrue if removed, false otherwise

Size

Size of map

method : public : Size() ~ Int
Return
TypeDescription
Intsize of queue

ToString

Formats the collection into a string. If an element implements the 'Stringify' interface, it's 'ToString()' is called.

method : public : ToString() ~ String
Return
TypeDescription
Stringstring representation