Haxe API Documentation
Back |
Indexclass List<T>
Available in flash8, neko, js, flash, php, cpp
A linked-list of elements. The list is composed of two-elements arrays
that are chained together. It's optimized so that adding or removing an
element doesn't imply to copy the whole array content everytime.
- var length(default,null) : Int
- The number of elements in this list.
- function new() : Void
- Creates a new empty list.
- function add(item : T) : Void
- Add an element at the end of the list.
- function clear() : Void
- Makes the list empty.
- function filter(f : T -> Bool) : List<T>
- Returns a list filtered with
f
. The returned list
will contain all elements x
for which f(x) = true
. - function first() : Null<T>
- Returns the first element of the list, or null
if the list is empty.
- function isEmpty() : Bool
- Tells if a list is empty.
- function iterator() : Iterator<T>
- Returns an iterator on the elements of the list.
- function join(sep : String) : String
- Join the element of the list by using the separator
sep
. - function last() : Null<T>
- Returns the last element of the list, or null
if the list is empty.
- 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>
- Removes the first element of the list and
returns it or simply returns null if the
list is empty.
- function push(item : T) : Void
- Push an element at the beginning of the list.
- function remove(v : T) : Bool
- Remove the first element that is
== v
from the list.
Returns true
if an element was removed, false
otherwise. - function toString() : String
- Returns a displayable representation of the String.
Back |
Index