class ArrayList implements ArrayAccess, Countable, IteratorAggregate

Provides the base class for a generic list (items can be accessed by index).

Methods

static ArrayList
from(array $array)

Transforms array to ArrayList.

getIterator()

Returns an iterator over all items.

int
count()

Returns items count.

void
offsetSet(int|null $index, T $value)

Replaces or appends a item.

T
offsetGet(int $index)

Returns a item.

bool
offsetExists(int $index)

Determines whether a item exists.

void
offsetUnset(int $index)

Removes the element at the specified position in this list.

void
prepend(T $value)

Prepends a item.

Details

at line 32
static ArrayList from(array $array)

Transforms array to ArrayList.

Parameters

array $array

Return Value

ArrayList

at line 48
ArrayIterator getIterator()

Returns an iterator over all items.

Return Value

ArrayIterator

at line 57
int count()

Returns items count.

Return Value

int

at line 69
void offsetSet(int|null $index, T $value)

Replaces or appends a item.

Parameters

int|null $index
T $value

Return Value

void

Exceptions

OutOfRangeException

at line 89
T offsetGet(int $index)

Returns a item.

Parameters

int $index

Return Value

T

Exceptions

OutOfRangeException

at line 104
bool offsetExists(int $index)

Determines whether a item exists.

Parameters

int $index

Return Value

bool

at line 115
void offsetUnset(int $index)

Removes the element at the specified position in this list.

Parameters

int $index

Return Value

void

Exceptions

OutOfRangeException

at line 129
void prepend(T $value)

Prepends a item.

Parameters

T $value

Return Value

void

Traits

Strict class for better experience.