| Package | system.data.lists |
| Class | public class ArrayList |
| Inheritance | ArrayList ArrayCollection Object |
| Implements | List |
| Subclasses | SortedArrayList |
Example :
import system.data.lists.ArrayList ;
var list:ArrayList = new ArrayList() ;
list.add("item1") ;
list.add("item3") ;
list.addAt( 1 , "item2" ) ;
trace( list ) ; // {item1,item2,item3}
trace( list.toSource() ) ; // new system.data.lists.ArrayList(["item1","item2","item3"])
| Property | Defined By | ||
|---|---|---|---|
| modCount : int
This property is a protector used in the ListIterator object of this List. | ArrayList | ||
| Method | Defined By | ||
|---|---|---|---|
ArrayList(init:* = null)
Creates a new ArrayList instance. | ArrayList | ||
add(o:*):Boolean [override]
Inserts an element in the collection. | ArrayList | ||
addAll(c:Collection):Boolean [override]
Appends all of the elements in the specified collection to the end of this Collection, in the order that they are returned by the specified collection's iterator (optional operation). | ArrayList | ||
addAt(index:uint, o:*):void
Inserts the specified element at the specified position in this list (optional operation). | ArrayList | ||
clear():void [override]
Removes all elements in the collection. | ArrayList | ||
clone():* [override]
Returns a shallow copy of this collection (optional operation). | ArrayList | ||
![]() | contains(o:*):Boolean
Returns true if this collection contains the specified element. | ArrayCollection | |
![]() | containsAll(c:Collection):Boolean
Returns true if this collection contains all of the elements of the specified collection. | ArrayCollection | |
ensureCapacity(capacity:uint):void
Increases the capacity of this ArrayList instance, if necessary, to ensure that it can hold at least the number of elements specified by the minimum capacity argument. | ArrayList | ||
![]() | equals(o:*):Boolean
Compares the specified object with this object for equality. | ArrayCollection | |
![]() | get(key:*):*
Returns the element from this collection at the passed key index. | ArrayCollection | |
![]() | indexOf(o:*, fromIndex:uint = 0):int
Returns the index of an element in the collection. | ArrayCollection | |
![]() | isEmpty():Boolean
Returns true if this collection contains no elements. | ArrayCollection | |
![]() |
Returns the iterator reference of the object. | ArrayCollection | |
lastIndexOf(o:*, fromIndex:int = 0x7FFFFFFF):int
Returns the index in this list of the last occurrence of the specified element, or -1 if this list does not contain this element. | ArrayList | ||
listIterator(position:uint = 0):ListIterator
Returns a ListIterator of the elements in this list (in proper sequence). | ArrayList | ||
remove(o:*):* [override]
Removes a single instance of the specified element from this collection, if it is present (optional operation). | ArrayList | ||
![]() | removeAll(c:Collection):Boolean
Removes from this Collection all the elements that are contained in the specified Collection (optional operation). | ArrayCollection | |
removeAt(id:uint, len:int = 1):*
Removes from this list all the elements that are contained between the specific id position and the end of this list (optional operation). | ArrayList | ||
removeRange(fromIndex:uint, toIndex:uint):*
Removes from this List all of the elements whose index is between fromIndex, inclusive and toIndex, exclusive. | ArrayList | ||
![]() | retainAll(c:Collection):Boolean
Retains only the elements in this Collection that are contained in the specified Collection (optional operation). | ArrayCollection | |
set(index:uint, o:*):*
Replaces the element at the specified position in this list with the specified element (optional operation). | ArrayList | ||
![]() | size():uint
Returns the number of elements in this collection. | ArrayCollection | |
Returns a view of the portion of this list between the specified fromIndex, inclusive, and toIndex, exclusive. | ArrayList | ||
![]() | toArray():Array
Returns an array containing all of the elements in this collection. | ArrayCollection | |
![]() | toSource(indent:int = 0):String
Returns the source code string representation of the object. | ArrayCollection | |
![]() | toString():String
Returns the string representation of this instance. | ArrayCollection | |
| modCount | property |
modCount:intThis property is a protector used in the ListIterator object of this List.
public function get modCount():int public function set modCount(value:int):void| ArrayList | () | Constructor |
public function ArrayList(init:* = null)Creates a new ArrayList instance.
Usage
new ArrayList() ;
new ArrayList( ar:Array ) ;
new ArrayList( it:Iterable ) ;
new ArrayList( co:Collection ) ;
new ArrayList( capacity:uint ) ;
Parameters init:* (default = null) — An optional Array or Collection or Iterable object to fill the collection.
This parameter can be an uint value to determinates the default capacity of the list.
|
See also
| add | () | method |
override public function add(o:*):BooleanInserts an element in the collection.
Parameters
o:* |
Boolean |
| addAll | () | method |
override public function addAll(c:Collection):BooleanAppends all of the elements in the specified collection to the end of this Collection, in the order that they are returned by the specified collection's iterator (optional operation).
Parameters
c:Collection |
Boolean — true if this list changed as a result of the call.
|
| addAt | () | method |
public function addAt(index:uint, o:*):voidInserts the specified element at the specified position in this list (optional operation).
Parameters
index:uint | |
o:* |
| clear | () | method |
override public function clear():voidRemoves all elements in the collection.
| clone | () | method |
override public function clone():*Returns a shallow copy of this collection (optional operation).
Returns* — a shallow copy of this collection (optional operation).
|
| ensureCapacity | () | method |
public function ensureCapacity(capacity:uint):voidIncreases the capacity of this ArrayList instance, if necessary, to ensure that it can hold at least the number of elements specified by the minimum capacity argument.
Parameters
capacity:uint |
| lastIndexOf | () | method |
public function lastIndexOf(o:*, fromIndex:int = 0x7FFFFFFF):intReturns the index in this list of the last occurrence of the specified element, or -1 if this list does not contain this element.
Parameters
o:* | |
fromIndex:int (default = 0x7FFFFFFF) |
int — the index in this list of the last occurrence of the specified element, or -1 if this list does not contain this element.
|
| listIterator | () | method |
public function listIterator(position:uint = 0):ListIteratorReturns a ListIterator of the elements in this list (in proper sequence).
Example :
import system.data.lists.ArrayList ;
import system.data.ListIterator ;
var a:Array = ["item0", "item1", "item2", "item3", "item4"] ;
var list:ArrayList = new ArrayList( a ) ;
var it:ListIterator = list.listIterator(2) ;
trace ("---- ListIterator hasPrevious/previous") ;
while(it.hasNext())
{
trace(">> " + it.next() + " : " + it.key()) ;
it.remove() ;
}
trace ("next : " + list) ;
trace ("---- ListIterator hasPrevious/previous") ;
var cpt:uint = list.size() ;
while(it.hasPrevious())
{
it.previous() ;
it.set("element" + cpt--) ;
}
trace ("list : " + list) ;
Parameters
position:uint (default = 0) |
ListIterator — a ListIterator of the elements in this list (in proper sequence).
|
| remove | () | method |
override public function remove(o:*):*Removes a single instance of the specified element from this collection, if it is present (optional operation).
Parameters
o:* |
* |
| removeAt | () | method |
public function removeAt(id:uint, len:int = 1):*
Removes from this list all the elements that are contained between the specific id position and the end of this list (optional operation).
Parameters
id:uint — The index of the element or the first element to remove.
| |
len:int (default = 1) — The number of elements to remove (default 1).
|
* — The Array representation of all elements removed in the original list.
|
| removeRange | () | method |
public function removeRange(fromIndex:uint, toIndex:uint):*Removes from this List all of the elements whose index is between fromIndex, inclusive and toIndex, exclusive.
Shifts any succeeding elements to the left (reduces their index).
This call shortens the list by (toIndex - fromIndex) elements. (If toIndex==fromIndex, this operation has no effect.)
Parameters
fromIndex:uint — The from index (inclusive) to remove elements in the list.
| |
toIndex:uint — The to index (exclusive) to remove elements in the list.
|
* |
| set | () | method |
public function set(index:uint, o:*):*Replaces the element at the specified position in this list with the specified element (optional operation).
Example :
import system.data.lists.ArrayList ;
var list:ArrayList = new ArrayList( [ "item1", "item2", "item3", "item4" ] ) ;
list.set(0, "item") ;
trace(list) ;
// {item,item2,item3,item4}
list.set(1, undefined) ;
trace(list) ;
// {item,item3,item4}
list.set( 5 , "item" ) ;
trace(list) ;
// RangeError: The ArrayList.set() method failed, the index '5' argument is out of the size limit.
Parameters
index:uint — index of element to replace.
| |
o:* — element to be stored at the specified position or if o is undefined the stored value is remove (like with the removeAt() method).
|
* — the element previously at the specified position or undefined.
|
| subList | () | method |
public function subList(fromIndex:uint, toIndex:uint):ListReturns a view of the portion of this list between the specified fromIndex, inclusive, and toIndex, exclusive.
Parameters
fromIndex:uint | |
toIndex:uint |
List — a view of the portion of this list between the specified fromIndex, inclusive, and toIndex, exclusive.
|