-
Notifications
You must be signed in to change notification settings - Fork 2
ArrayList
| Jump To | Go Back |
Methods | Variables |
|---|
Implements: IterableList
An array-based list-type data structure.
| Jump To | top |
index | next | previous | push | insert | replace | pop | clear | size | from_array |
|---|
Returns: mixed
Throws: IndexOutOfBounds
| Name | Type | Purpose |
|---|---|---|
| index | int |
The position to read from |
Reads the value at the given index in the list. If the index is out of range an IndexOutOfBounds will be thrown.
Returns: mixed or EOL
| Name | Type | Purpose |
|---|---|---|
| None |
Seeks the next value in the list after the last read position, or EOL if the list has been fully traversed. Can use index() to set the next read position.
Returns: mixed or EOL
| Name | Type | Purpose |
|---|---|---|
| None |
Seeks the previous value in the list before the last read position, or EOL if the front of the list has been reached. Can use index() to set the next read position.
Returns: self
| Name | Type | Purpose |
|---|---|---|
| *values... | mixed |
One or more values |
Adds the given values to the end of the list
Throws: IndexOutOfBounds
| Name | Type | Purpose |
|---|---|---|
| index | int |
The position to insert at |
| value | mixed |
The value to be inserted |
Inserts the value at the given index in the list. If the index is out of range an IndexOutOfBounds will be thrown.
Throws: IndexOutOfBounds
| Name | Type | Purpose |
|---|---|---|
| index | int |
The position to write to |
| value | Mixed | The value to write |
Writes the value to the given index in the list. If the index is out of range an IndexOutOfBounds will be thrown.
Returns: mixed
Throws: IndexOutOfBounds
| Name | Type | Purpose |
|---|---|---|
| *index | int |
If provided, the value will be 'popped' from this position |
Removes an entry from the list and returns its value. If an index is provided it will remove and return that item, otherwise it will look for the last entry in the list. If the index is out of range, or the list is empty, an IndexOutOfBounds will be thrown.
| Name | Type | Purpose |
|---|---|---|
| None |
Clears the list
Returns: int
| Name | Type | Purpose |
|---|---|---|
| None |
Returns the size of the list
Returns: self
Throws: InvalidArgumentType
| Name | Type | Purpose |
|---|---|---|
| array | array |
An array to retrieve values from |
Traverses the array and adds those values to this list. If array is not an array, InvalidArgumentType is thrown.
| Jump To | top |
|---|
| Name | Type | Initial | Purpose |
|---|---|---|---|
| __Content | array |
[] | The internal array of data |
| __Index | int |
0 | The last traversed index |
Devon Mullane 2020