Item (Arraylist property): Difference between revisions
Jump to navigation
Jump to search
m (1 revision) |
m (→Syntax) |
||
Line 7: | Line 7: | ||
===Syntax terms=== | ===Syntax terms=== | ||
<table class="syntaxTable"> | <table class="syntaxTable"> | ||
<tr><th>% | <tr><th>%currentItem</th> | ||
<td>A variable of the same type as specified on the <var class="term">al</var> declaration to contain the value of | <td>A variable of the same type as specified on the <var class="term">al</var> declaration to contain the value of the specified <var class="term">al</var> item.</td></tr> | ||
<tr><th>al</th> | <tr><th>al</th> | ||
<td>An <var>Arraylist</var> object. </td></tr> | <td>An <var>Arraylist</var> object. </td></tr> | ||
<tr><th>number</th> | <tr><th>number</th> | ||
<td>A whole number greater than 0 to identify an <var class="term">al</var> item by its position within the arraylist. If <var class="term">number</var> is greater than the number of items in the <var class="term">al</var>, or if it is less than or equal to zero, the request is cancelled.</td></tr> | <td>A whole number greater than 0 to identify an <var class="term">al</var> item by its position within the arraylist. If <var class="term">number</var> is greater than the number of items in the <var class="term">al</var>, or if it is less than or equal to zero, the request is cancelled.</td></tr> | ||
<tr><th>newItem</th> | |||
<td>A value of the same type as specified on the <var class="term">al</var> declaration to be assigned to the specified <var class="term">al</var> item. </td></tr> | |||
</table> | </table> | ||
Revision as of 04:33, 11 February 2011
Return or set Arraylist item value (Arraylist class)
This ReadWrite property returns or sets the indicated item in the Arraylist. For additional description of this method, see Coding considerations for collections.
Syntax
%currentItem = al:Item( number) al:Item( number) = newItem
Syntax terms
%currentItem | A variable of the same type as specified on the al declaration to contain the value of the specified al item. |
---|---|
al | An Arraylist object. |
number | A whole number greater than 0 to identify an al item by its position within the arraylist. If number is greater than the number of items in the al, or if it is less than or equal to zero, the request is cancelled. |
newItem | A value of the same type as specified on the al declaration to be assigned to the specified al item. |
Usage notes
- The
Item
keyword is not required. For instance, in the For loop in the Arraylist class example,print %alist(%i)
is equivalent to:print %alist:Item(%i)
See also
- Methods are available to retrieve or set just the first or last item in an Arraylist; see FirstItem and LastItem respectivly.