OverviewSingleDeprecated

jsx3.util

class List

Object
->jsx3.lang.Object
  ->jsx3.util.List

class List
extends jsx3.lang.Object
An object-oriented version of the built-in JavaScript Array class.

Note that methods such as indexOf and remove compare objects with the strict equality operators (=== and !==). Therefore, for the purposes of this class 1 and "1" are not equal.

Since:

3.2

Constructor Summary
void
init(a : int | Array | jsx3.util.List, bLive : boolean)
The instance initializer.
Method Summary
void
add(objElm : Object, intAt : int)
void
addAll(a : Array | jsx3.util.List, intAt : int)
void
Removes all elements from this list.
jsx3.util.List
Returns a copy of this list.
boolean
contains(objElm : Object)
boolean
equals(l : Object)
Returns true if this list and l have the same length and this.get(n) = l.get(n) for all n.
jsx3.util.List
filter(fctFilter : Function)
Creates a new list with the filtered contents of this list.
Object
get(intIndex : int)
void
Deprecated. Use the jsx3.util.Iterator interface instead.
void
getItem(intIndex : ?)
Deprecated. Use get() instead.
void
Deprecated. Use size() instead.
void
Deprecated. Use the jsx3.util.Iterator interface instead.
int
indexOf(objElm : Object, intStartAt : int)
Returns the index of the first occurrence of objElm in this list.
jsx3.util.Iterator
int
lastIndexOf(objElm : Object, intStartAt : int)
Returns the index of the last occurrence of objElm in this list.
jsx3.util.List | Object
map(fctMapper : Function, bExpand : boolean, bObject : boolean)
Creates a new list with the mapped contents of this array.
void
move(intIndex : ?)
Deprecated. Use the jsx3.util.Iterator interface instead.
void
Deprecated. Use the jsx3.util.Iterator interface instead.
void
remove(objElm : Object)
Removes the first occurrence of objElm in this list.
Object | jsx3.util.List<Object>
removeAt(intStart : int, intEnd : int)
Removes a single or a range of elements from this list.
void
Deprecated. Use the jsx3.util.Iterator interface instead.
void
set(intIndex : int, objElm : Object)
int
List
slice(intStart : int, intEnd : int)
Returns a section of this list as another list.
void
sort(fctComparator : Function)
Sorts this list.
Array
toArray(bLive : boolean)
Returns a copy of this list as an array.
static jsx3.util.List
If a is already an instance of this class, this method returns a.
Methods Inherited From jsx3.lang.Object
eval, getClass, getInstanceOf, getInstanceOfClass, getInstanceOfPackage, instanceOf, isInstanceOf, isSubclassOf, jsxmix, jsxsuper, jsxsupermix, setInstanceOf, toString
Constructor Detail

init

void init(a : int | Array | jsx3.util.List, bLive : boolean)
The instance initializer. Creates a new list. If a is a number, the list is initialized with that size. If a is an array or list, the contents of a are copied into the new list.

Parameters:

a
bLive
Method Detail

add

void add(objElm : Object, intAt : int)

Parameters:

objElm
intAt

addAll

void addAll(a : Array | jsx3.util.List, intAt : int)

Parameters:

a
intAt

Throws:

{jsx3.lang.IllegalArgumentException}if a is not a list or array.

clear

void clear()
Removes all elements from this list.

clone

jsx3.util.List clone()
Returns a copy of this list.

Returns:

 

Overrides:

clone in jsx3.lang.Object

contains

boolean contains(objElm : Object)

Parameters:

objElmthe item to find

Returns:

 

equals

boolean equals(l : Object)
Returns true if this list and l have the same length and this.get(n) = l.get(n) for all n.

Parameters:

l

Returns:

 

Overrides:

equals in jsx3.lang.Object

filter

jsx3.util.List filter(fctFilter : Function)
Creates a new list with the filtered contents of this list. 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:

 

get

Object get(intIndex : int)

Parameters:

intIndex

Returns:

 

getIndex

void getIndex()
Deprecated. Use the jsx3.util.Iterator interface instead.

getItem

void getItem(intIndex : ?)
Deprecated. Use get() instead.

Parameters:

intIndex

getLength

void getLength()
Deprecated. Use size() instead.

hasNext

void hasNext()
Deprecated. Use the jsx3.util.Iterator interface instead.

indexOf

int indexOf(objElm : Object, intStartAt : int)
Returns the index of the first occurrence of objElm in this list. Comparisons are performed with strict equals (===).

Parameters:

objElmthe item to find
intStartAt

Returns:

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

iterator

jsx3.util.Iterator iterator()

Returns:

 

lastIndexOf

int lastIndexOf(objElm : Object, intStartAt : int)
Returns the index of the last occurrence of objElm in this list. Comparisons are performed with strict equals (===).

Parameters:

objElmthe item to find
intStartAt

Returns:

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

map

jsx3.util.List | Object map(fctMapper : Function, bExpand : boolean, bObject : boolean)
Creates a new list 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:

a list if the bObject parameter is null or false, otherwise an Object.  

move

void move(intIndex : ?)
Deprecated. Use the jsx3.util.Iterator interface instead.

Parameters:

intIndex

next

void next()
Deprecated. Use the jsx3.util.Iterator interface instead.

remove

void remove(objElm : Object)
Removes the first occurrence of objElm in this list.

Parameters:

objElmthe object to remove

Returns:

the removed object or null if no object was removed  

removeAt

Object | jsx3.util.List<Object> removeAt(intStart : int, intEnd : int)
Removes a single or a range of elements from this list.

Parameters:

intStart
intEnd

Returns:

the removed object or null if no object was removed  

reset

void reset()
Deprecated. Use the jsx3.util.Iterator interface instead.

set

void set(intIndex : int, objElm : Object)

Parameters:

intIndex
objElm

size

int size()

Returns:

 

slice

List slice(intStart : int, intEnd : int)
Returns a section of this list as another list. The returned section is a copy of this list and is not affected by subsequent changes to this list.

Parameters:

intStart
intEnd

Returns:

 

sort

void sort(fctComparator : Function)
Sorts this list.

Parameters:

fctComparator

toArray

Array toArray(bLive : boolean)
Returns a copy of this list as an array.

Parameters:

bLiveif true, then the returned array is the actual backing array of this list.

Returns:

 

wrap

static jsx3.util.List wrap(a : Array | jsx3.util.List)
If a is already an instance of this class, this method returns a. If a is an array, this method returns a new List instance backed by a.

Parameters:

a

Throws:

{jsx3.lang.IllegalArgumentException}if a is not a list or array.

Returns: