Add (Arraylist function)

From m204wiki
Jump to navigation Jump to search

Add Arraylist items (Arraylist class)

Add adds an item to the end of an Arraylist.

Syntax

[%count =] al:Add( itemList)

Syntax terms

%count An, optional, numeric variable that returns the number of items in the indicated Arraylist after the item has been added. %count is also the item number associated with the last or only added item in the Arraylist.
al An Arraylist object.
itemList Under Sirius Mods 7.9 and later this can be a comma-delimited set of values or variables of the same type as specified on the al declaration or collections of objects of the same type as specified on the al declaration. Each of these, from left to right, becomes an item or items in the method object Arraylist.

Under Sirius Mods 7.8 and earlier itemList can only be a single value or variable of the same type as specified on the al declaration, or a value or variable convertible to that type to be added to the al Arraylist object.

Of course, a single value or variable is just a single item list so can be specified under Sirius Mods 7.9 and later, too.

Usage notes

  • The Push and Enqueue functions are the same as the Add function:
    • Push was designed as a convenience for use with the Pop function.
    • Enqueue was designed as a convenience for use with the Dequeue function.

Examples

For examples of Add calls, see Arraylist class.

See also