Insert (Arraylist function): Difference between revisions
Jump to navigation
Jump to search
m (what's in a name) |
m (it's example dag nab it) |
||
Line 1: | Line 1: | ||
{{Template:Arraylist:Insert subtitle}} | {{Template:Arraylist:Insert subtitle}} | ||
The <var>Insert</var> callable function inserts a new item before the <var class="term">number</var> item in the <var>Arraylist</var>. | The <var>Insert</var> callable function inserts a new item before the <var class="term">number</var> item in the <var>Arraylist</var>. | ||
Line 21: | Line 20: | ||
<li>If <var class="term">number</var> is equal to the number of items in the <var>Arraylist</var> plus one, the new item is added to the end of the <var>Arraylist</var>. | <li>If <var class="term">number</var> is equal to the number of items in the <var>Arraylist</var> plus one, the new item is added to the end of the <var>Arraylist</var>. | ||
<li>If <var class="term">number</var> is greater than the number of items in the <var>Arraylist</var> plus one, or less than or equal to zero, the request is cancelled. | <li>If <var class="term">number</var> is greater than the number of items in the <var>Arraylist</var> plus one, or less than or equal to zero, the request is cancelled. | ||
</ul> | </ul> | ||
==Examples== | |||
<ol><li>For an example using the <var>Insert</var> method, see [[Arraylist class|"Arraylist class"]]. | |||
</ol> | |||
==See also== | ==See also== | ||
{{Template:Arraylist:Insert footer}} | {{Template:Arraylist:Insert footer}} |
Revision as of 06:55, 11 March 2011
Insert items into Arraylist (Arraylist class)
The Insert callable function inserts a new item before the number item in the Arraylist.
Syntax
[%count =] al:Insert( number, itemList)
Syntax terms
%count | An, optional, numeric variable to return the number of items in the indicated Arraylist after the item has been inserted. |
---|---|
al | An Arraylist object. |
number | A whole number, from 1 to the number of items in al plus one, to identify an al item before which collectionItem will be inserted. |
collectionItem | A value or variable of the same type as specified on the al declaration, or a value or variable convertible to that type; to be inserted into al. |
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.
Examples
- For an example using the Insert method, see "Arraylist class".