A linked-list of elements. The list is composed of element container objects that are chained together. It is optimized so that adding or removing an element does not imply copying the whole list content every time.

See:

Constructor

new ()

Creates a new empty list.

Variables

read onlylength:Int

The length of this List.

Methods

add (item:T):Void

Adds element item at the end of this List.

this.length increases by 1.

clear ():Void

Empties this List.

This function does not traverse the elements, but simply sets the internal references to null and this.length to 0.

first ():Null<T>

Returns the first element of this List, or null if no elements exist.

This function does not modify this List.

isEmpty ():Bool

Tells if this List is empty.

inline iterator ():ListIterator<T>

Returns an iterator on the elements of the list.

pop ():Null<T>

Returns the first element of this List, or null if no elements exist.

The element is removed from this List.

push (item:T):Void

Adds element item at the beginning of this List.

this.length increases by 1.

remove (v:T):Bool

Removes the first occurrence of v in this List.

If v is found by checking standard equality, it is removed from this List and the function returns true.

Otherwise, false is returned.