Insert (Arraylist function): Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (1 revision)
m (match syntax diagram to template and fix tags)
Line 2: Line 2:


This callable function
This callable function
inserts an item before the ''number'' item in the <var>Arraylist</var>.
inserts an item before the <var class="term">number</var> item in the <var>Arraylist</var>.
 
==Syntax==
==Syntax==
{{Template:Arraylist:Insert syntax}}
{{Template:Arraylist:Insert syntax}}
===Syntax terms===
===Syntax terms===
<table class="syntaxTable">
<table class="syntaxTable">
<tr><th><i>%num</i></th>
<tr><th><i>%count</i></th>
<td>A numeric variable to contain the number of items in the indicated <var>Arraylist</var> after the item has been inserted. </td></tr>
<td>An, optional, numeric variable to return the number of items in the indicated <var>Arraylist</var> after the item has been inserted. </td></tr>
<tr><th><i><var class="term">al</var></i></th>
<tr><th><i>al</i></th>
<td>An <var>Arraylist</var> object. </td></tr>
<td>An <var>Arraylist</var> object. </td></tr>
<tr><th><i>number</i></th>
<tr><th><i>number</i></th>
<td>A whole number greater than 0 to identify an ''<var class="term">al</var>'' item. </td></tr>
<td>A whole number greater than 0 to identify an <var class="term">al</var> item. </td></tr>
<tr><th><i>item</i></th>
<tr><th><i>collectionItem</i></th>
<td>A value or variable of the same type as specified on the ''<var class="term">al</var>'' declaration, or a value or variable convertible to that type.</td></tr>
<td>A value or variable of the same type as specified on the <var class="term">al</var> declaration, or a value or variable convertible to that type; to be inserted into <var class="term">al</var>.</td></tr>
</table>
</table>
==Usage notes==
==Usage notes==
<ul>
<ul> <li>If <var class="term">number</var> is less than or equal to the number of items in the <var>Arraylist</var>, the new item is inserted before the indicated item.
<li>If ''number'' is less than or equal to the number of items
<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>.
in the <var>Arraylist</var>, the new item is inserted before the indicated item.
<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 ''number'' 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 ''number'' 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>For an example using the <var>Insert</var> method, see [[Arraylist class]].
<li>For an example using the <var>Insert</var> method, see [[Arraylist class]].
</ul>
</ul>
==See also==
==See also==
{{Template:Arraylist:Insert footer}}
{{Template:Arraylist:Insert footer}}

Revision as of 04:47, 30 January 2011

Insert items into Arraylist (Arraylist class)


This callable function inserts an 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 greater than 0 to identify an al item.
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.
  • For an example using the Insert method, see Arraylist class.

See also