MaximumItem (Arraylist function): Difference between revisions
Jump to navigation
Jump to search
m (Automatically generated page update) |
mNo edit summary |
||
Line 1: | Line 1: | ||
{{Template:Arraylist:MaximumItem subtitle}} | {{Template:Arraylist:MaximumItem subtitle}} | ||
<var>MaximumItem</var> is related to the <var>[[Maximum (Arraylist function)|Maximum]]</var> <var>Arraylist</var> method, which return the number or name of the item that has the maximum value in the collection. | |||
==Syntax== | ==Syntax== | ||
{{Template:Arraylist:MaximumItem syntax}} | {{Template:Arraylist:MaximumItem syntax}} | ||
===Syntax terms=== | ===Syntax terms=== | ||
<table class="syntaxTable"> | <table class="syntaxTable"> | ||
<tr><th>%item</th><td>item</td></tr> | <tr><th>%item</th> | ||
<td>An <var>Arraylist</var> item of the same type as the <var class="term">al</var> object.</td></tr> | |||
<tr><th>al</th> | <tr><th>al</th> | ||
<td>Arraylist object</td></tr> | <td>An <var>Arraylist</var> object.</td></tr> | ||
<tr><th>method</th> | <tr><th>method</th> | ||
<td><var> | <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> | ||
</table> | </table> | ||
==Usage notes== | ==Usage notes== | ||
<ul> | |||
<li>The optional <var class="term">method</var> parameter lets you further manipulate the <var>Arraylist</var> item values before performing the | |||
<var>MaximumItem</var> method's item matching. | |||
If your <var>Arraylist</var> items are not intrinsic values, you must specify a <var class="term">method</var> function that can map the item values to intrinsic values or the method will fail. | |||
</ul> | |||
==Examples== | ==Examples== | ||
For the <var>ArrayList</var> <code>%al</code> whose items are the odd integers between 0 and 10, <code>%al:maxItem</code> returns <code>9</code>. | |||
==See also== | ==See also== | ||
{{Template:Arraylist:MaximumItem footer}} | {{Template:Arraylist:MaximumItem footer}} |
Revision as of 21:34, 17 July 2012
Get item that has maximum value (Arraylist class)
[Introduced in Sirius Mods 7.8]
MaximumItem is related to the Maximum Arraylist method, which return the number or name of the item that has the maximum value in the collection.
Syntax
%item = al:MaximumItem[( [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 (probably Float) 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 MaximumItem 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:maxItem
returns 9
.