Packagecom.yworks.support
Classpublic class ArrayList
InheritanceArrayList Inheritance flash.utils.Proxy
Implements List

A basic list implementation that is backed by an Array.

This class also lets you use [ ] array notation to access the getItemAt() and setItemAt() methods. The for each..in loop is also supported.



Public Methods
 MethodDefined By
  
ArrayList(collection:Iterable = null)
Creates a new instance based on the given collection.
ArrayList
  
addAll(iter:Iterable):void
Adds all of the elements in the specified collection to this collection (optional operation).
ArrayList
  
addItem(item:Object):Boolean
Adds the specified item to this collection.
ArrayList
  
clear():void
Removes all of the elements from this collection.
ArrayList
  
contains(item:Object):Boolean
Returns true if the given item is contained in this collection.
ArrayList
  
getItemAt(index:int):Object
Returns the element at the specified position in this collection.
ArrayList
  
indexOf(item:Object):int
Returns the index of the first occurrence of the specified element in this list, or -1 if this list does not contain the element.
ArrayList
  
insert(item:Object, index:uint):void
Inserts the specified element at the specified position in this list.
ArrayList
  
isEmpty():Boolean
ArrayList
  
Returns an iterator over a set of elements.
ArrayList
  
length():uint
Returns the number of elements in this collection.
ArrayList
  
removeAt(index:uint):void
Removes the element at the specified position in this list.
ArrayList
  
removeItem(item:Object):Boolean
Removes a single instance of the specified element from this collection, if it is present (optional operation).
ArrayList
  
sort(comparisonFunction:Function = null, sortOptions:int = -1):void
Sorts the List by using a comparisionFunction.
ArrayList
  
toArray():Array
Copies the items of this List to an array and returns it.
ArrayList
  
toString():String
ArrayList
Constructor Detail
ArrayList()Constructor
public function ArrayList(collection:Iterable = null)

Creates a new instance based on the given collection.

Parameters
collection:Iterable (default = null) — A collection whose contents will be copied to the ArrayList.
Method Detail
addAll()method
public function addAll(iter:Iterable):void

Adds all of the elements in the specified collection to this collection (optional operation).

Parameters

iter:Iterable — the collection containing elements to be added to this collection

addItem()method 
public function addItem(item:Object):Boolean

Adds the specified item to this collection. Returns true if this collection changed as a result of the call. (Returns false if this collection does not permit duplicates and already contains the specified element.)

Parameters

item:Object — element whose presence in this collection is to be ensured

Returns
Boolean — true if this collection changed as a result of the call
clear()method 
public function clear():void

Removes all of the elements from this collection. The collection will be empty after this method returns.

contains()method 
public function contains(item:Object):Boolean

Returns true if the given item is contained in this collection. Note that the normal equality operator is used to check whether the item is contained, i.e. this method yields true if item == otherItem for one otherItem in the collection.

Parameters

item:Object

Returns
Boolean
getItemAt()method 
public function getItemAt(index:int):Object

Returns the element at the specified position in this collection.

Parameters

index:int — the index of the element to return

Returns
Object — the element at the specified position in this list
indexOf()method 
public function indexOf(item:Object):int

Returns the index of the first occurrence of the specified element in this list, or -1 if this list does not contain the element.

Parameters

item:Object — the element to search for

Returns
int — the index of the first occurrence of the specified element in this list, or -1 if this list does not contain the element
insert()method 
public function insert(item:Object, index:uint):void

Inserts the specified element at the specified position in this list. Shifts the element currently at that position (if any) and any subsequent elements to the right (adds one to their indices).

Parameters

item:Object — element to be inserted
 
index:uint — index at which the specified element is to be inserted

isEmpty()method 
public function isEmpty():Boolean

Returns
Boolean
iterator()method 
public function iterator():Iterator

Returns an iterator over a set of elements.

Returns
Iterator — an Iterator.
length()method 
public function length():uint

Returns the number of elements in this collection.

Returns
uint — the number of elements in this collection
removeAt()method 
public function removeAt(index:uint):void

Removes the element at the specified position in this list. Shifts any subsequent elements to the left (subtracts one from their indices).

Parameters

index:uint — the index of the element to be removed

removeItem()method 
public function removeItem(item:Object):Boolean

Removes a single instance of the specified element from this collection, if it is present (optional operation).

Parameters

item:Object — element to be removed from this collection, if present

Returns
Boolean — true if an element was removed as a result of this call
sort()method 
public function sort(comparisonFunction:Function = null, sortOptions:int = -1):void

Sorts the List by using a comparisionFunction.

Parameters

comparisonFunction:Function (default = null) — A function used for comparison
 
sortOptions:int (default = -1) — An optional option parameter

toArray()method 
public function toArray():Array

Copies the items of this List to an array and returns it.

Returns
Array
toString()method 
public function toString():String

Returns
String