New (Arraylist constructor): Difference between revisions
Jump to navigation
Jump to search
m (→Syntax terms) |
mNo edit summary |
||
Line 9: | Line 9: | ||
<td>An Arraylist object that is set to a new Arraylist object reference.</td></tr> | <td>An Arraylist object that is set to a new Arraylist object reference.</td></tr> | ||
<tr><th><var>%(Arraylist)</var></th> | <tr><th><var>%(Arraylist)</var></th> | ||
<td>The optional class name in parentheses denotes a <var>[[Notation conventions for methods#Constructors|Constructor]]</var>. | <td>The optional class name in parentheses denotes a <var>[[Notation conventions for methods#Constructors|Constructor]]</var>. See "Usage notes," below, for more information about invoking a collection <var>Constructor</var>. | ||
</table> | </table> | ||
==Usage notes== | ==Usage notes== | ||
<ul> | <ul> | ||
<li>New | <li>As described in [[Object variables#Using New or other Constructors|"Using New or other Constructors"]], <var>New</var> can be invoked with no object, with an explicit class name, or with an object variable, even if that object is <var>Null</var>: | ||
object, with an explicit class name, or with an object variable, | <p class="code">%al = new | ||
even if that object is | |||
< | %al = %(Arraylist of float):new | ||
%al = %al:new | |||
</p> | |||
</ | |||
'''Note:''' | '''Note:''' | ||
As shown above, when explicitly indicating the | |||
class, both the collection and item datatypes must be | class, both the collection and item datatypes must be | ||
specified just as they are on the collection variable's declaration: | specified just as they are on the collection variable's declaration: | ||
< | <p class="code">%arrayl is collection Arraylist of longstring | ||
%arrayl = %(Arraylist of longstring):new | |||
</p> | |||
</ | |||
</ul> | </ul> | ||
==See also== | ==See also== | ||
{{Template:Arraylist:New footer}} | {{Template:Arraylist:New footer}} |
Revision as of 22:30, 26 July 2011
Create a new Arraylist object (Arraylist class)
This method returns a new instance of an Arraylist.
Syntax
%al = [%(Arraylist Of itemType):]New
Syntax terms
%al | An Arraylist object that is set to a new Arraylist object reference. |
---|---|
%(Arraylist) | The optional class name in parentheses denotes a Constructor. See "Usage notes," below, for more information about invoking a collection Constructor. |
Usage notes
- As described in "Using New or other Constructors", New can be invoked with no object, with an explicit class name, or with an object variable, even if that object is Null:
%al = new %al = %(Arraylist of float):new %al = %al:new
Note: As shown above, when explicitly indicating the class, both the collection and item datatypes must be specified just as they are on the collection variable's declaration:
%arrayl is collection Arraylist of longstring %arrayl = %(Arraylist of longstring):new