Pop (Arraylist function): Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (1 revision)
m (1 revision)
Line 1: Line 1:
{{Template:Arraylist:Pop subtitle}}
{{Template:Arraylist:Pop subtitle}}
[[Category:Arraylist methods|Pop function]]
[[Category:Arraylist methods|Pop function]]
<!--DPL?? Category:Arraylist methods|<var>Pop</var> function: Retrieve last Arraylist item, then remove item-->
<!--DPL?? Category:<var>Arraylist</var> methods|<var>Pop</var> function: Retrieve last <var>Arraylist</var> item, then remove item-->
<p>
<p>
<var>Pop</var> is a member of the [[Arraylist class]].
<var>Pop</var> is a member of the [[Arraylist class]].
Line 7: Line 7:


This callable function returns the current contents of the last item
This callable function returns the current contents of the last item
in the method object Arraylist; then it removes that item.
in the method object <var>Arraylist</var>; then it removes that item.


<var>Pop</var> is available in ''Sirius Mods'' version 7.0 and later.
<var>Pop</var> is available in ''Sirius Mods'' version 7.0 and later.
Line 15: Line 15:
<table class="syntaxTable">
<table class="syntaxTable">
<tr><th><i>%item</i></th>
<tr><th><i>%item</i></th>
<td>A variable of the same type as specified on the ''%arrayl'' declaration to contain the contents of the last ''%arrayl'' item. </td></tr>
<td>A variable of the same type as specified on the ''<var class="term">al</var>'' declaration to contain the contents of the last ''<var class="term">al</var>'' item. </td></tr>
<tr><th><i>%arrayl</i></th>
<tr><th><i><var class="term">al</var></i></th>
<td>An Arraylist object.</td></tr>
<td>An <var>Arraylist</var> object.</td></tr>
</table>
</table>
==Usage notes==
==Usage notes==
<ul>
<ul>
<li>The <var>Pop</var> method for object %arrayl is equivalent to
<li>The <var>Pop</var> method for object <var class="term">al</var> is equivalent to
specifying <tt>%arrayl:[[Item (Arraylist property)|Item]](%arrayl:Count)</tt>
specifying <tt><var class="term">al</var>:[[Item (Arraylist property)|Item]](<var class="term">al</var>:Count)</tt>
followed by <tt>%arrayl:[[RemoveItem (Arraylist function)|RemoveItem]](%arrayl:Count)</tt>.
followed by <tt><var class="term">al</var>:[[RemoveItem (Arraylist function)|RemoveItem]](<var class="term">al</var>:Count)</tt>.
<li>[[LastItem (Arraylist property)|LastItem]]
<li>[[LastItem (Arraylist property)|LastItem]]
returns the last item of an Arraylist without removing it.
returns the last item of an <var>Arraylist</var> without removing it.
[[Dequeue (Arraylist function)|Dequeue]]
[[Dequeue (Arraylist function)|Dequeue]]
returns the first item of an Arraylist, then removes it.
returns the first item of an <var>Arraylist</var>, then removes it.
<li>The [[Push (Arraylist function)|Push]] function, a synonym for Add,
<li>The [[Push (Arraylist function)|Push]] function, a synonym for Add,
appends an item to an Arraylist.
appends an item to an <var>Arraylist</var>.
</ul>
</ul>

Revision as of 02:29, 20 January 2011

Retrieve last Arraylist item, then remove item (Arraylist class)

Pop is a member of the Arraylist class.

This callable function returns the current contents of the last item in the method object Arraylist; then it removes that item.

Pop is available in Sirius Mods version 7.0 and later.

Syntax

[%item =] al:Pop

Syntax terms

%item A variable of the same type as specified on the al declaration to contain the contents of the last al item.
al An Arraylist object.

Usage notes

  • The Pop method for object al is equivalent to specifying al:Item(al:Count) followed by al:RemoveItem(al:Count).
  • LastItem returns the last item of an Arraylist without removing it. Dequeue returns the first item of an Arraylist, then removes it.
  • The Push function, a synonym for Add, appends an item to an Arraylist.