class List<T>
Available on all platforms
A linked-list of elements. The list is composed of two-elements arrays that are chained together. It is optimized so that adding or removing an element does not imply copying the whole array content every time.
Instance Fields
function 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.
function filter(f:T ->Bool):List<T>
Returns a list filtered with f
. The returned list will contain all
elements for which f(x) == true
.
function first():Null<T>
Returns the first element of this
List, or null if no elements exist.
This function does not modify this
List.
function join(sep:String):String
Returns a string representation of this
List, with sep
separating
each element.
function last():Null<T>
Returns the last element of this
List, or null if no elements exist.
This function does not modify this
List.
function map<X>(f:T ->X):List<X>
Returns a new list where all elements have been converted by the
function f
.
function pop():Null<T>
Returns the first element of this
List, or null if no elements exist.
The element is removed from this
List.
function push(item:T):Void
Adds element item
at the beginning of this
List.
this.length
increases by 1.