Arraylist class: Difference between revisions

From m204wiki
Jump to navigation Jump to search
mNo edit summary
mNo edit summary
Line 30: Line 30:
to which the method is being applied, sometimes called the "method object"
to which the method is being applied, sometimes called the "method object"
or the "method Arraylist".
or the "method Arraylist".
Additional conventions are described in [[Notation conventions for methods]].
Additional conventions are described in [[Notation conventions for methods|"Notation conventions for methods"]].
==See also==
==See also==
<table>
<table>

Revision as of 19:48, 20 May 2011

Arraylists can be thought of as traditional arrays with no bounds and much more flexibility.

The following code illustrates several of the Arraylist methods:

%alist is collection Arraylist of longstring %i is float %alist = new %alist:add('Idle') %alist:add('Gumby') %alist:add('Chapman') %alist:add('Pallin') %alist:insert(2, 'Jones') %alist:removeItem(4) %alist(3) = 'Cleese' for %i from 1 to %alist:count print %alist(%i) end for

This code snippet would print:

Idle Jones Cleese Pallin

The individual Arraylist methods are described in the following subsections. In the method templates, al is used to represent the object to which the method is being applied, sometimes called the "method object" or the "method Arraylist". Additional conventions are described in "Notation conventions for methods".

See also

List of Arraylist methods For a list of all methods in the Arraylist class, with a brief description of each.
Collections For background information about collections and Arraylists and about declaring Arraylist object variables.
Coding considerations for collections For tips on using collections.