New (Arraylist constructor): Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (1 revision)
 
(10 intermediate revisions by 2 users not shown)
Line 7: Line 7:
<tr><th>%al</th>
<tr><th>%al</th>
<td>An Arraylist object variable that is set to a new Arraylist object reference.</td></tr>
<td>An Arraylist object variable that is set to a new Arraylist object reference.</td></tr>
<tr><th><var>%(Arraylist)</var></th>
<tr><th nowrap="true"><var>[%(Arraylist Of </var>itemType<var>):]</var></th>
<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>.</td></tr>
<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>.</td></tr>
   
   
Line 14: Line 14:
==Usage notes==
==Usage notes==
<ul>
<ul>
<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>:
<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 specification, or with an object variable in the class, even if that object is <var>Null</var>:
<p class="code">%al = new
<p class="code">%al = new



Latest revision as of 20:24, 30 November 2011

Create a new Arraylist object (Arraylist class)


Syntax

%al = [%(Arraylist Of itemType):]New

Syntax terms

%al An Arraylist object variable that is set to a new Arraylist object reference.
[%(Arraylist Of itemType):] 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 specification, or with an object variable in the class, 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 the item datatype must be specified just as they are on the collection variable's declaration:

    %arrayl is collection Arraylist of longstring %arrayl = %(Arraylist of longstring):new

See also