OverviewSingleDeprecated

window

class Array

Object
->Array

Direct Known Subclasses:

jsx3.$Array

native class Array
extends Object
Native JavaScript class Array. Includes GI extensions.

Field Summary
native int
length
An unsigned, 32-bit integer that specifies the number of elements in an array.
Constructor Summary
native void
Method Summary
Array
Deprecated. Use the jsx3.util.List class.
native Array
concat(array : Array...)
Joins two or more arrays and returns a new array.
void
contains(objElement : ?)
Deprecated. Use the jsx3.util.List class.
boolean
Deprecated. Use the jsx3.util.List class.
Array
filter(fctFilter : Function)
Deprecated. Use the jsx3.util.List class.
int
indexOf(objElement : Object, intStartAt : int)
Deprecated. Use the jsx3.util.List class.
native String
join(separator : String)
Joins all elements of an array into a string.
int
lastIndexOf(objElement : Object, intStartAt : int)
Deprecated. Use the jsx3.util.List class.
Array | Object
map(fctMapper : Function, bExpand : boolean, bObject : boolean)
Deprecated. Use the jsx3.util.List class.
native Object
pop()
Removes the last element from an array and returns that element.
native int
push(element : Object...)
Adds one or more elements to the end of an array and returns the new length of the array.
void
pushAll(a : Array)
Deprecated. Use the jsx3.util.List class.
void
remove(objElement : ?)
Deprecated. Use the jsx3.util.List class.
native void
Transposes the elements of an array: the first array element becomes the last and the last becomes the first.
native Object
Removes the first element from an array and returns that element.
native Array
slice(begin : int, end : int)
Extracts a section of an array and returns a new array.
native void
sort(compareFunction : Function)
Sorts the elements of an array.
native Array
splice(index : int, howMany : int, element : Object...)
Changes the content of an array, adding new elements while removing old elements.
native String
Returns a string representing the specified array and its elements.
native int
unshift(element : Object...)
Adds one or more elements to the beginning of an array and returns the new length of the array.
Field Detail

length

native int length
An unsigned, 32-bit integer that specifies the number of elements in an array.
Constructor Detail

Array

native void Array()
Method Detail

clone

Array clone()
Deprecated. Use the jsx3.util.List class.
creates a copy of this array

Returns:

 

concat

native Array concat(array : Array...)
Joins two or more arrays and returns a new array.

Parameters:

array

Returns:

 

contains

void contains(objElement : ?)
Deprecated. Use the jsx3.util.List class.

Parameters:

objElement

contentsEqual

boolean contentsEqual(a : Array)
Deprecated. Use the jsx3.util.List class.
Returns true if this array and a have the same length and this[n] = a[n] for all n.

Parameters:

a

Returns:

 

filter

Array filter(fctFilter : Function)
Deprecated. Use the jsx3.util.List class.
Creates a new array with the filtered contents of this array. The fctFilter parameter defines the filtering function.

Parameters:

fctFiltera function that is called once for each item in this array and returns true if the item should be included in the filtered list. The signature of this function is function(item : Object) : boolean.

Returns:

 

Since:

3.1

indexOf

int indexOf(objElement : Object, intStartAt : int)
Deprecated. Use the jsx3.util.List class.
Returns the index of the first occurrence of objElement in this array.

Parameters:

objElementthe item to find
intStartAt

Returns:

the index of the found object or -1 if not found 

join

native String join(separator : String)
Joins all elements of an array into a string.

Parameters:

separator

Returns:

 

lastIndexOf

int lastIndexOf(objElement : Object, intStartAt : int)
Deprecated. Use the jsx3.util.List class.
Returns the index of the last occurrence of objElement in this array.

Parameters:

objElementthe item to find
intStartAt

Returns:

the index of the found object or -1 if not found 

map

Array | Object map(fctMapper : Function, bExpand : boolean, bObject : boolean)
Deprecated. Use the jsx3.util.List class.
Creates a new array with the mapped contents of this array. The fctMapper parameter defines the mapping function.

This method has four modes corresponding to the four possible values for {bExpand, bObject}:

Parameters:

fctMappera function that is called once for each item in this array and returns the mapped value. The signature of this function depends on the values for the bExpand and bObject parameters.
bExpandif true, the resulting mapped array or object may any number of values corresponding to each item in this list. Otherwise, it will have exactly one value for each item in this list.
bObjectif true, this array is mapped to an object with property name/value pairs. Otherwise this array is mapped to another array.

Returns:

an Array if the bObject parameter is null or false, otherwise an Object

Since:

3.1

pop

native Object pop()
Removes the last element from an array and returns that element. This method changes the length of the array.

Returns:

 

push

native int push(element : Object...)
Adds one or more elements to the end of an array and returns the new length of the array. This method changes the length of the array.

Parameters:

element

Returns:

the new length of the array 

pushAll

void pushAll(a : Array)
Deprecated. Use the jsx3.util.List class.
pushes the contents of an Array onto this Array.

Parameters:

a

remove

void remove(objElement : ?)
Deprecated. Use the jsx3.util.List class.
removes the first occurrence of objElement in this array

Parameters:

objElementthe object to remove

Returns:

the removed object or null if no object was removed 

reverse

native void reverse()
Transposes the elements of an array: the first array element becomes the last and the last becomes the first.

shift

native Object shift()
Removes the first element from an array and returns that element. This method changes the length of the array.

Returns:

 

slice

native Array slice(begin : int, end : int)
Extracts a section of an array and returns a new array.

Parameters:

beginZero-based index at which to begin extraction.
endZero-based index at which to end extraction.

Returns:

 

sort

native void sort(compareFunction : Function)
Sorts the elements of an array.

If compareFunction is supplied, the array elements are sorted according to the return value of the compare function. If a and b are two elements being compared, then:

Parameters:

compareFunctionSpecifies a function that defines the sort order. If omitted, the array is sorted lexicographically (in dictionary order) according to the string conversion of each element.

splice

native Array splice(index : int, howMany : int, element : Object...)
Changes the content of an array, adding new elements while removing old elements.

Parameters:

indexIndex at which to start changing the array.
howManyAn integer indicating the number of old array elements to remove. If howMany is 0, no elements are removed. In this case, you should specify at least one new element.
elementThe elements to add to the array. If you don't specify any elements, splice simply removes elements from the array.

Returns:

an array containing the removed elements 

toString

native String toString()
Returns a string representing the specified array and its elements.

Returns:

 

Overrides:

toString in Object

unshift

native int unshift(element : Object...)
Adds one or more elements to the beginning of an array and returns the new length of the array.

Parameters:

element

Returns:

the new length of the array