PureMVC Framework for haXe: API Documentation
Back |
Indexextern class Array<T>
An Array is a storage for values. You can access it using indexes or
with its API. On the server side, it's often better to use a List
which
is less memory and CPU consuming, unless you really need indexed access.
- var length(default,null) : Int
-
The length of the Array
- function new() : Void
-
Creates a new Array.
- function concat(a : Array<T>) : Array<T>
-
Returns a new Array by appending
a
to this
.
- function copy() : Array<T>
-
Returns a copy of the Array. The values are not
copied, only the Array structure.
- function insert(pos : Int, x : T) : Void
-
Inserts the element
x
at the position pos
.
All elements after pos
are moved one index ahead.
- function iterator() : Iterator<Null<T>>
-
Returns an iterator of the Array values.
- function join(sep : String) : String
-
Returns a representation of an array with
sep
for separating each element.
- function pop() : Null<T>
-
Removes the last element of the array and returns it.
- function push(x : T) : Int
-
Adds the element
x
at the end of the array.
- function remove(x : T) : Bool
-
Removes the first occurence of
x
.
Returns false if x
was not present.
Elements are compared by using standard equality.
- function reverse() : Void
-
Reverse the order of elements of the Array.
- function shift() : Null<T>
-
Removes the first element and returns it.
- function slice(pos : Int, ?end : Int) : Array<T>
-
Copies the range of the array starting at
pos
up to,
but not including, end
. Both pos
and end
can be
negative to count from the end: -1 is the last item in
the array.
- function sort(f : T -> T -> Int) : Void
-
Sort the Array according to the comparison function
f
.
f(x,y)
should return 0
if x == y
, >0
if x > y
and <0
if x < y
.
- function splice(pos : Int, len : Int) : Array<T>
-
Removes
len
elements starting from pos
an returns them.
- function toString() : String
-
Returns a displayable representation of the Array content.
- function unshift(x : T) : Void
-
Adds the element
x
at the start of the array.
Back |
Index