array

Dynamically-sized array type. An array is zero-based

Methods

append(any element) append the element to the array
apply(function func) replace each element of the array with the result of applying the given function
clear() removes all elements from the array
filter(function function) create a subarray containing all elements in the array that return true from the given method
find(any value) return the index of the given value in the array, null if not found
insert(integer index, any element) insert the element at the given index
len() returns the number of elements in the array
pop() remove and return the last element from the array
push(any element) append the element to the array
reduce(function func) reduce an array to a single value by applying the given function to pairs of values
remove(integer index) remove the element at the given index
resize(integer size, any fill) resize the array, using the element 'fill' to pad any extra slots
reverse() reverse the elements in the array
slice(integer start, integer end) returns a subarray as a new array
sort(function comparator) sorts the array, using the comparator function if given
top() returns the last element of the array

Method Documentation


void append(any element)

Append the element to the array

Parameters


void apply(function func)

Replace each element of the array with the result of applying the given function

Parameters


void clear()

Removes all elements from the array


array filter(function function)

Create a subarray containing all elements in the array that return true from the given method

Parameters

Returns


any find(any value)

Return the index of the given value in the array, null if not found

Parameters

Returns


void insert(integer index, any element)

Insert the element at the given index

Parameters


integer len()

Returns the number of elements in the array

Returns


any pop()

Remove and return the last element from the array

Returns


void push(any element)

Append the element to the array

Parameters


any reduce(function func)

Reduce an array to a single value by applying the given function to pairs of values

Parameters

Returns


void remove(integer index)

Remove the element at the given index

Parameters


void resize(integer size, any fill)

resize the array, using the element 'fill' to pad any extra slots

Parameters


void reverse()

Reverse the elements in the array


array slice(integer start, integer end)

Returns a subarray as a new array

Parameters

Returns


void sort(function comparator)

Sorts the array, using the comparator function if given

Parameters


any top()

Returns the last element of the array

Returns



Creative Commons Logo This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.