A List is an ordered collection of values.

Class Methods (see Type)

New
With no parameter, it creates an empty list. With a single Integer, it creates a list with that many 'null' values. With parameters, it creates a list whose size is the number of values, populated by the parameter values in order.

Instance Methods

[]
Get (or set) the element specified by the integer parameter. If the integer value is negative, it indexes relative to the end of the list.
<<
Append (push) the value(s) onto the end of the List
>>
Insert (prepend or shift) the value(s) at the beginning of the List
Clone
Create and return new list containing a shallow copy of elements from original list. One can specify the starting position (default 0) and number (to end of list) of elements to copy from the original list. A negative starting position is relative to the number of elements in the list.
Each
Returns an closure that iterates over the list, returning the index and the next sequential element of the list each time it is called.
empty?
Return true if List has no elements
Fill
Fill elements of list to a specified value. The first value is the fill value. The starting position for the fill is the second parameter. Its default is 0. If negative, it is relative to the size of the list. The last parameter specifies the number of elements to fill. Unspecified, it fills to the end of the list.
Find
Find first element that is === to specified element. Return index value, or null if not found.
Insert
Insert one or more values into the List starting at the index specified by the integer parameter. If the integer value is negative, it indexes relative to the end of the list.
Merge
Append second list's contents to end of self.
Pop
Remove and return the last value of a list. null is returned if the list is empty.
Randomize
Shuffle the list so that each element is in a random new spot.
Reverse
Reverse the order of elements in the list.
Remove
Remove one or more values from the List starting at the index specified by an integer. If the integer value is negative, it indexes relative to the end of the list. A second parameter can specify the number of elements to remove (default is 1).
RemoveValue
Remove a specific value from the list wherever it appears. This uses === for matching.
Resize
Forces the array's allocated memory to the specified size, shrinking or growing it (with nulls) as needed.
Shift
Remove and return the first value of a list. null is returned if the list is empty.
size
Get (or set) the number of values held in the List.
Sort
Sorts the list's elements in ascending order, comparing each element using the passed method (or '<=>' by default).
Sub
(pos, len, arr2, pos2, len2) Copy specified elements from second list into self, replacing element's at specified positions