New (SortOrder constructor): Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
mNo edit summary |
||
Line 13: | Line 13: | ||
</td></tr> | </td></tr> | ||
<tr><th><var>%(SortOrder For</var> itemtype)</th> | <tr><th><var>%(SortOrder For</var> itemtype)</th> | ||
<td> | <td>For this non-shared function, the optional class name in parentheses denotes a <var>[[Notation conventions for methods#Constructors|Constructor]]</var>. See [[#Usage notes|"Usage notes"]], below, for more information about invoking a <var>SortOrder</var> <var>Constructor</var>. | ||
</td></tr> | </td></tr> | ||
</table> | </table> | ||
Line 27: | Line 27: | ||
</p> | </p> | ||
'''Note:''' | '''Note:''' | ||
As shown above, | As shown above, if you explicitly specify the | ||
class, | class name, you must include the item datatype of the collection to be sorted, just as on a <var>SortOrder</var> object variable's [[SortOrder class#Declaring a SortOrder object variable|declaration]]. | ||
<var>New</var> can also be invoked directly as a parameter of a <var>[[Sort (Arraylist subroutine)|Sort]]</var> subroutine or <var>[[SortNew (GenericNamedArraylist function)|SortNew]]</var> function: | <var>New</var> can also be invoked directly as a parameter of a <var>[[Sort (Arraylist subroutine)|Sort]]</var> subroutine or <var>[[SortNew (GenericNamedArraylist function)|SortNew]]</var> function: |
Revision as of 22:14, 29 July 2011
Create a new, null SortOrder (SortOrder class)
The SortOrder instance created by New is empty, that is, without a
sorting order or sorting key.
Applied as the parameter of a collection class sorting method, an empty SortOrder
produces a copy of the input collection.
Syntax
%sortOrder = [%(SortOrder For itemType):]New
Syntax terms
%sortOrder | A SortOrder object variable to contain the new object instance. |
---|---|
%(SortOrder For itemtype) | For this non-shared function, the optional class name in parentheses denotes a Constructor. See "Usage notes", below, for more information about invoking a SortOrder Constructor. |
Usage notes
- As described in "Using New or other Constructors", New can be invoked with no object, with an explicit class specification, or with an object variable in the class, even if that object is Null:
%sord = new %sord = %(SortOrder for object stringlist):new %sord = %sord:new
Note: As shown above, if you explicitly specify the class name, you must include the item datatype of the collection to be sorted, just as on a SortOrder object variable's declaration.
New can also be invoked directly as a parameter of a Sort subroutine or SortNew function:
%arraylist2 = %arraylist1:sortnew(new)