Arraylist class: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
| Line 11: | Line 11: | ||
%alist:add('Gumby') | %alist:add('Gumby') | ||
%alist:add('Chapman') | %alist:add('Chapman') | ||
%alist:add(' | %alist:add('Palin') | ||
%alist:insert(2, 'Jones') | %alist:insert(2, 'Jones') | ||
%alist:removeItem(4) | %alist:removeItem(4) | ||
| Line 23: | Line 23: | ||
Jones | Jones | ||
Cleese | Cleese | ||
Palin | |||
</p> | </p> | ||
Latest revision as of 22:03, 12 February 2026
An Arraylist can be thought of as a traditional array with no bounds and much more flexibility.
The following code shows 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('Palin') %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 Palin
List of Arraylist methods
The "List of Arraylist methods" shows all the class methods, with a brief description of each.
See also
| Collections | For background information about collections and Arraylists and about declaring Arraylist object variables. |
|---|---|
| Coding considerations for collections | For tips on using collections. |