UnorderedSet

The UnorderedSet object is container that stores one or more unique objects. It is similar to a StringSet except it can store variants of any type (rather than just strings), and the contents are not kept sorted (in fact, the order of set members is unspecified). Like a StringSet it uses a dictionary system to locate members rather than numeric indexes. You can therefore lookup members much more quickly than by linearly searching a Vector.

 

You can create a new UnorderedSet using the DOpusFactory object.

 

Property Name

Return Type

Description

count

int

Returns the number of elements the UnorderedSet currently holds.

empty

bool

Returns True if the UnorderedSet is empty, False if not.

length

int

A synonym for count.

size

int

A synonym for count.

 

Method Name

Arguments

Return Type

Description

assign

<UnorderedSet:from>

none

Copies the contents of another UnorderedSet to this one. You can also pass an array or Vector object.

clear

none

none

Clears the contents of the UnorderedSet.

erase

variant

none

Erases the element if it exists in the set.

exists

variant

bool

Returns True if the specified element exists in the set.

insert

variant

bool

Inserts the element into the set if it doesn't already exist. Returns True if successful.

merge

<UnorderedSet:from>

none

Merges the contents of another UnorderedSet with this one.