Skip to content
MusNik edited this page May 28, 2020 · 4 revisions

ArrayList Class

Constructor:

new ArrayList([array])

List struct build on top of an array.

Parameters:

Name Type Description
[array] *[] Optional. Array to make the ArrayList from.

Members:

array : *[]

Can be used with an accessor or as a reference, points to the same array for full lifecycle.

Type: *[]

Methods:

add(...value)

Adds a new value to the ArrayList, will be added at the end.

Parameters:

Name Type Description
...value * Multiple. Value(s) to add to the ArrayList.

remove(pos)

Removes the value at a specific position within the ArrayList.

Parameters:

Name Type Description
pos real Position of value to delete.

size() 🠆 real

Returns the number of items in the ArrayList.

Returns:

real

find_index(value) 🠆 real

Checks the ArrayList for a value.

Parameters:

Name Type Description
value * Value to find.

Returns:

real Index of value found in ArrayList, -1 if value doesn't exist.

clear(value)

Clears all data from the ArrayList making array size to 0.

is_empty() 🠆 bool

Checks the ArrayList to see if it is empty.

Returns:

bool

sort(ascending)

Modifies the ArrayList, sorting it with the quicksort algorithm (strings sorted alphabetically).

Parameters:

Name Type Description
ascending bool Whether the values should be ascending (true) or descending (false) order.

copy(source)

Copies the contents of one ArrayList into another.

Parameters:

Name Type Description
source ArrayList ArrayList to be copied from.

clone() 🠆 ArrayList

Returns a shallow copy of this ArrayList.

Returns:

ArrayList

Clone this wiki locally