shadow:utility

Class ArrayList<V>

Parent class

shadow:standard@Object

Interfaces

shadow:utility@List<V>

class ArrayList<V>

Class ArrayList<V> stores a list of elements of type V, implemented with a dynamic array as internal storage.

Create Summary

Modifiers Return Types Method and Description
public () create()
public () create(long initialCapacity)
public () create(long initialCapacity, Equate<V> equater)

Destroy Summary

Modifiers Return Types Method and Description
public () destroy()

Method Summary

Modifiers Return Types Method and Description
public (ArrayList<V>) add(V value)

Adds an element to the end of the list.

public (ArrayList<V>) clear()

Removes all elements from the list.

public readonly (boolean) contains(V value)

Checks to see if the list contains a particular element.

public readonly (ArrayList<V>) copy(AddressMap addresses)
public (V) delete(long index)

Removes the element at the given index.

public readonly (V) index(long index)

Retrieves the element at the given index.

public () index(long index, V value)

Stores an element into the given index.

public readonly (long) indexOf(V value)

Finds the first index where a particular element is present.

public readonly (boolean) isEmpty()

Checks whether or not the list is empty.

public readonly (Iterator<V>) iterator()

Creates an iterator to iterate over all the values in the list.

public (boolean) remove(V value)

Removes the first occurrence of an element.

public readonly (String) toString()

Produces a String representation of the list, listing all elements in order.

Property Summary

Modifiers Return Types Method and Description
public readonly get (int) size()
public readonly get locked (long) sizeLong()

Gets size of the list.

Create Detail

create

public create() => ()

create

public create(long initialCapacity) => ()

create

public create(long initialCapacity, Equate<V> equater) => ()

Destroy Detail

destroy

public destroy() => ()

Method Detail

add

public add(V value) => (ArrayList<V>)

Adds an element to the end of the list. This operation is constant time in the best case and amortized constant time in the worst case, which occurs when list storage is full and a linear-time array resize must be performed.

Parameters

value - value of element

Returns

list after the add

clear

public clear() => (ArrayList<V>)

Removes all elements from the list. This operation is constant time.

Returns

list after being cleared

contains

public readonly contains(V value) => (boolean)

Checks to see if the list contains a particular element.

Parameters

value - element to search for

Returns

true if present

copy

public readonly copy(AddressMap addresses) => (ArrayList<V>)

delete

public delete(long index) => (V)

Removes the element at the given index. This operation is linear time in the worst case.

Parameters

index - index of element to remove

Returns

element being removed

Throws

IndexOutOfBoundsException - if an illegal index is specified

index

public readonly index(long index) => (V)

Retrieves the element at the given index. Legal indexes are from 0 to one less than the size of the list. This operation is constant time.

Parameters

index - location of element

Returns

element

Throws

IndexOutOfBoundsException - if an illegal index is specified

index

public index(long index, V value) => ()

Stores an element into the given index. Legal indexes are from 0 to the size of the list. If an element is stored into the index corresponding to the size of the list, the list's size will increase by one. This operation is linear time in the worst case.

Parameters

index - location of element

value - value of element

Throws

IndexOutOfBoundsException - if an illegal index is specified

indexOf

public readonly indexOf(V value) => (long)

Finds the first index where a particular element is present. If the element is not present, -1 will be returned.

Parameters

value - element to search for

Returns

index of element or -1 if not found

isEmpty

public readonly isEmpty() => (boolean)

Checks whether or not the list is empty.

Returns

true if the list is empty

iterator

public readonly iterator() => (Iterator<V>)

Creates an iterator to iterate over all the values in the list.

Returns

iterator

remove

public remove(V value) => (boolean)

Removes the first occurrence of an element. This operation is linear time in the worst case.

Parameters

value - value of element to remoe

Returns

true if the element was found and removed

toString

public readonly toString() => (String)

Produces a String representation of the list, listing all elements in order.

Returns

String representation

Property Detail

size

public readonly get size() => (int)

sizeLong

public readonly get locked sizeLong() => (long)

Gets size of the list.