Insert (Arraylist function)

From m204wiki
Revision as of 21:07, 4 January 2011 by 198.242.244.47 (talk) (Created page with "<span style="font-size:120%; color:black"><b><section begin=dpl_desc/>Insert item into Arraylist<section end=dpl_desc/></b></span> Insert function ...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

<section begin=dpl_desc/>Insert item into Arraylist<section end=dpl_desc/>

Insert is a member of the Arraylist class.

This callable function inserts an item before the number item in the Arraylist.

Syntax

  [%num =] %arrayl:Insert(number, item)

Syntax Terms

%num
A numeric variable to contain the number of items in the indicated Arraylist after the item has been inserted.
%arrayl
An Arraylist object.
number
A whole number greater than 0 to identify an %arrayl item.
item
A value or variable of the same type as specified on the %arrayl declaration, or a value or variable convertible to that type.

Usage Notes

  • If number is less than or equal to the number of items in the Arraylist, the new item is inserted before the indicated item.
  • If number is equal to the number of items in the Arraylist plus one, the new item is added to the end of the Arraylist.
  • If number is greater than the number of items in the Arraylist plus one, or less than or equal to zero, the request is cancelled.
  • For an example using the Insert method, see Arraylist class.