Product SiteDocumentation Site

5.3.6. The Array Class

An array is a possibly sparse collection with indexes that are positive whole numbers. You can reference array items by using one or more indexes. The number of indexes is the same as the number of dimensions of the array. This number is called the dimensionality of the array.
Array items can be any valid Rexx object. If an object has not been assigned to an array index then that index is considered to contain the NIL object.

Table 5.16. ooRexx Array Class

Object
Array
+ OrderedCollection
new
of
allIndexes
allItems
append
at, []
delete
dimension
dimensions
empty
fill
first
firstItem
hasIndex
hasItem
index
insert
isEmpty
items
last
lastItem
makeArray
makeString
next
previous
put, []=
remove
removeItem
section
size
sort
sortWith
stableSort
stableSortWith
supplier
toString

Note

The Array class also has available class methods that its metaclass, the Class class (Section 5.1.2, “The Class Class”), defines. It also inherits methods from the OrderedCollection class (Section 5.3.4, “The OrderedCollection Class”).
Array objects are variable-sized. The dimensionality of an array is fixed, but the size of each dimension is variable. When you create an array, you can specify a hint about how many elements you expect to put into the array or the array's dimensionality. However, you do not need to specify a size or dimensionality of an array when you are creating it. You can use any whole-number indexes to reference items in an array.
For any array method that takes an index, the index may be specified as either individual arguments or as an array of indexes. For example, the following are equivalent:

Example 5.128. Array class - [] method

    x = myarray[1,2,3]   -- retrieves an item from a multi-dimension array
    index = .array~of(1,2,3)  -- create an index list
    x = myarray[index]   -- also retrieves from "1,2,3"

Methods such as index() (Section 5.3.6.20, “index”) that return index items will return a single numeric value for single-dimension arrays and an array of indexes for multi-dimension arrays.

5.3.6.1. Inherited Methods

Methods inherited from the Object class (Section 5.1.1, “The Object Class”).
new (Class Method)initsend
= \= == \== <> ><instanceMethodsendWith
|| '' (abuttal)' ' (blank)instanceMethodssetMethod
(Operator Methods)isAstart
classisInstanceOfstartWith
copyobjectNamestring
defaultNameobjectName=unsetMethod
hasMethodrequest 
identityHashrun 
Methods inherited from the Collection class (Section 5.3.2, “The Collection Class”).
[]equivalentput
[]=hasIndexsubset
allIndexeshasItemsupplier
allItemsindexunion
atintersectionxor
differenceitems 
disjointmakeArray 
Methods inherited from the OrderedCollection class (Section 5.3.4, “The OrderedCollection Class”).
appendintersectionsortWith
appendAlllaststableSort
deletelastItemstableSortWith
differencenextsubset
firstpreviousunion
firstItemsectionxor
insertsort