MinimumItem (Arraylist function): Difference between revisions

From m204wiki
Jump to navigation Jump to search
mNo edit summary
Line 15: Line 15:


<tr><th>method</th>
<tr><th>method</th>
<td>A function that operates on the type of the items in the <var>Arraylist</var>. It may be a [[Local and Common entities|local method]] or [[Method variables|method variable]] or a class member (<var>Variable</var>, <var>Property</var>), and it must return an [[Intrinsic classes|intrinsic]] (probably <var>Float</var>) value. The default <var class="term">method</var> value is the special identity function, <var>[[Collections#Using the This function as the Maximum parameter|This]]</var>, which simply returns the item value.</td></tr>
<td>A function that operates on the type of the items in the <var>Arraylist</var>. It may be a [[Local and Common entities|local method]] or [[Method variables|method variable]] or a class member (<var>Variable</var>, <var>Property</var>), and it must return an [[Intrinsic classes|intrinsic]] value. The default <var class="term">method</var> value is the special identity function, <var>[[Collections#Using the This function as the Maximum parameter|This]]</var>, which simply returns the item value.</td></tr>
</table>
</table>



Revision as of 19:09, 18 July 2012

Get item that has minimum value (Arraylist class)

[Introduced in Sirius Mods 7.8]


MinimumItem is related to the Minimum Arraylist method, which return the number or name of the item that has the minimum value in an Arraylist.

Syntax

%item = al:MinimumItem[( [itemFunction])]

Syntax terms

%item An Arraylist item of the same type as the al object.
al An Arraylist object.
method A function that operates on the type of the items in the Arraylist. It may be a local method or method variable or a class member (Variable, Property), and it must return an intrinsic value. The default method value is the special identity function, This, which simply returns the item value.

Usage notes

  • The optional method parameter lets you further manipulate the Arraylist item values before performing the MinimumItem method's item matching. If your Arraylist items are not intrinsic values, you must specify a method function that can map the item values to intrinsic values or the method will fail.

Examples

For the ArrayList %al whose items are the odd integers between 0 and 10, %al:minItem returns 1.

See also