The Set class is used for the storage and retrieval of data from a collection in which the values of the elements contained are unique and serve as the key values according to which the data is automatically ordered.
class Set extends Object
Called
Method
Description
add
Adds a value to the set.
cancelTimeOut
Cancels a previous method call to the Object.setTimeOut Method. (Inherited from Object.)
definitionString
Returns a description of the type of the elements in the set.
elements
Returns the number of elements in the set.
empty
Determines whether the set is empty.
equal
Overridden. Determines whether a set is identical to the current set.
getEnumerator
Creates an enumerator for a set. This allows you to traverse the set.
getTimeOutTimerHandle
Returns the timer handle for the object. (Inherited from Object.)
handle
Retrieves the handle of the class of the object. (Inherited from Object.)
in
Determines whether a particular value is a member of the set.
new
Overridden. Creates a set that can contain elements of the type specified by the parameter.
notify
Releases the hold on an object that has called a wait method on this object. (Inherited from Object.)
notifyAll
Releases a lock on the object that was issued by a wait method on this object. (Inherited from Object.)
objectOnServer
Determines whether the object is on a server. (Inherited from Object.)
owner
Returns the instance that owns the object. (Inherited from Object.)
pack
Serializes the current instance of the Set class.
remove
Removes a value from the set.
setTimeOut
Sets up the scheduled execution of a specified method. (Inherited from Object.)
toString
Overridden. Returns a string describing the set contents. For example, a "names" set might return {"Mary", "Paul", "Peter"}.
typeId
Returns the type of the values in the set.
usageCount
Returns the current number of references (the value of the reference counter) that the object has. (Inherited from Object.)
wait
Pauses a process. (Inherited from Object.)
xml
Overridden.
::create
Creates a set from the container obtained from a prior call to the Set.pack method.
::createFromXML
::difference
Calculates and retrieves the set containing the values from set1 that are not found in set2.
::intersection
Calculates and returns the identical values found in two sets.
::union
Calculates and retrieves the union of the two given sets. This is the set that contains the values found in at least one of the sets.
The values may be of any X++ type. All values in the set must have the same type.
When a value that is already stored in the set is added, it is ignored and does not increase the number of elements in the set. The values stored in the set can be traversed by using objects of type SetEnumerator. The contents of a set are stored in a way that facilitates efficient look up of the elements.
The following example checks whether any of the values in one set (noConfigs) are found in a second set (yesConfigs). If they are, they are removed from the yesConfigs set.
Set noConfigs; Set yesConfigs; ConfigId configId; SetEnumerator se; ; se = noConfigs.getEnumerator(); while (se.moveNext()) { configId = se.current(); if (yesConfigs.in(configId)) { yesConfigs.remove(configId); } }