SetHash
Unordered set of generic objects
# insert elements
set_hash := Collection.SetHash->New()<String>;
set_hash->Insert("San Francisco");
set_hash->Insert("Oakland");
set_hash->Insert("East Bay");
# get size
set_hash->Size()->PrintLine();
# get value by key
set_hash->Has("Oakland")->PrintLine();Operations
GetKeys
Get a collection of keys
method : public : GetKeys() ~ Vector<K>Return
| Type | Description |
|---|---|
| Vector<K> | vector of keys |
Has
Checks for key in set
method : public : Has(key:K) ~ BoolParameters
| Name | Type | Description |
|---|---|---|
| key | K | search key |
Return
| Type | Description |
|---|---|
| Bool | true if found, false otherwise |
Insert
Inserts a key into the set
method : public : Insert(key:K) ~ NilParameters
| Name | Type | Description |
|---|---|---|
| key | K | key |
IsEmpty
Checks to see if the set is empty
method : public : IsEmpty() ~ BoolReturn
| Type | Description |
|---|---|
| Bool | true if empty, false otherwise |
Remove
Removes a key from the set
method : public : Remove(key:K) ~ BoolParameters
| Name | Type | Description |
|---|---|---|
| key | K | key for value to remove |
Return
| Type | Description |
|---|---|
| Bool | true if removed, false otherwise |
ToString
Formats the collection into a string. If an element implements the 'Stringify' interface, it's 'ToString()' is called.
method : public : ToString() ~ StringReturn
| Type | Description |
|---|---|
| String | string representation |