List Class
Contains any number of elements that are accessed sequentially. Lists are structures that can contain values of any X++ type. All the values in the list must be of the same type.
Syntax
class List extends Object
Run On
Called
Methods
Method | Description | |
---|---|---|
addEnd | Adds a value to the end of the list. | |
addStart | Adds a value to the start of the list. | |
appendList | ||
cancelTimeOut | Cancels a previous method call to the setTimeOut method. (Inherited from Object.) | |
definitionString | Returns a description of the type of the elements in the list. | |
elements | Specifies the number of elements in a list. | |
empty | Determines whether a list is empty. | |
equal | Determines whether the specified object is equal to the current one. (Inherited from Object.) | |
equalTo | Determines whether a list is the same as the current list. | |
getEnumerator | Creates an enumerator for a list which allows you to traverse the list. | |
getTimeOutTimerHandle | Returns the timer handle for the object. (Inherited from Object.) | |
handle | Retrieves the handle of the class of the object. (Inherited from Object.) | |
new | Creates a list. (Overrides the new Method.) | |
notify | Releases the hold on an object that has called the wait method on this object. (Inherited from Object.) | |
notifyAll | Releases a lock on the object that was issued by the 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 List class. | |
setTimeOut | Sets up the scheduled execution of a specified method. (Inherited from Object.) | |
toString | Returns a description of the values in the list. (Overrides the toString Method.) | |
typeId | Returns the type of the values in a list. | |
usageCount | Returns the current number of references, that is, the value of the reference counter, that the object has. (Inherited from Object.) | |
wait | Pauses a process. (Inherited from Object.) | |
xml | Returns an XML string that represents the current object. (Overrides the xml Method.) | |
::create | Creates a list from the container obtained from a prior call to the List.pack method. | |
::createFromXML | ||
::equal | Determines whether two lists are identical. | |
::merge | Combines two lists to create a new list. |
Top
Remarks
The type of the values in the list is specified when the list is created and cannot be changed afterwards.
The implementation of lists makes traversal of the list elements very fast. Lists can be traversed by using the ListEnumerator class. To create a ListEnumerator object, use List.getEnumerator.
Examples
The following example creates a list of integers and prints out a description of the list and the values that it contains.
{
// Create a list of integers
List il = new List(Types::Integer);
// Add some elements to the list
il.addEnd(1);
il.addEnd(2);
il.addStart(3);
// Print a description of the list
print il.definitionString();
print il.toString();
pause;
}
Inheritance Hierarchy
Object Class
List Class