| Package | as3.collections |
| Class | public class ArrayList |
| Implements | IArrayList |
| Subclasses | ArrayListFx |
Can be considered as an ordinary Array wrapper.
Runtime of operations| Property | Defined by | ||
|---|---|---|---|
| numItems : uint [read-only]
Returns the size of the collection.
| ArrayList | ||
| Property | Defined by | ||
|---|---|---|---|
| _array : Array
The array.
| ArrayList | ||
| Method | Defined by | ||
|---|---|---|---|
|
Creates a new ArrayList.
| ArrayList | ||
|
addItem(item:*):Boolean
Adds an item to the list, usually at the end.
| ArrayList | ||
|
addItemAt(index:uint, item:*):uint
Adds an item at a specific position.
| ArrayList | ||
|
addItemAtEnd(item:*):uint
Adds an item at the end of the list.
| ArrayList | ||
|
addItemAtStart(item:*):uint
Adds an item in front of the list.
| ArrayList | ||
|
addItemsAt(index:uint, items:Array):uint
Adds an array of items at a specific position.
| ArrayList | ||
|
clear():void
Removes all items from the collection.
| ArrayList | ||
|
countItems(item:*):uint
Returns the number of occurrences of an item.
| ArrayList | ||
|
getFirstIndexOf(item:*):int
Returns the index of the first occurrence of an item.
| ArrayList | ||
|
getFirstItem():*
Returns the first item of the sequence.
| ArrayList | ||
|
getItemAt(index:uint):*
Returns the item at the specified position.
| ArrayList | ||
|
getIterator(cursor:uint = 0):IIterator
Returns an iterator over the list items starting at the specified position.
| ArrayList | ||
|
getLastItem():*
Returns the last item of the sequence.
| ArrayList | ||
|
hasItem(item:*):Boolean
Tests, if an item is contained by the list.
| ArrayList | ||
|
removeAll(item:*):uint
Removes all occurrences of a particular item from the list.
| ArrayList | ||
|
removeFirstItem():*
Removes the first item of the sequence.
| ArrayList | ||
|
removeItem(item:*):Boolean
Removes an item from the list.
| ArrayList | ||
|
removeItemAt(index:uint):*
Removes an item at the specified position.
| ArrayList | ||
|
removeItemsAt(index:uint, numItems:uint):Array
Removes a number of items starting at the specified position.
| ArrayList | ||
|
removeLastItem():*
Removes the last item of the sequence.
| ArrayList | ||
|
replaceItemAt(index:uint, item:*):Boolean
Replaces the item at the specified position.
| ArrayList | ||
|
reverse():void
Reverses the list order.
| ArrayList | ||
|
setArray(array:Array):void
Specifies an array to be maintained by the list.
| ArrayList | ||
|
sort(comparator:IComparator):void
Sorts the list by the given criterion.
| ArrayList | ||
|
toArray():Array
Returns an array of all items in the order of the particular collection.
| ArrayList | ||
|
toString():String
Info
| ArrayList | ||
| Method | Defined by | ||
|---|---|---|---|
|
itemRemoved(item:*, index:uint):void
Template method to notify subclasses after an item has been removed.
| ArrayList | ||
| _array | property |
protected var _array:ArrayThe array.
| numItems | property |
numItems:uint [read-only]Returns the size of the collection.
Implementation public function get numItems():uint
| ArrayList | () | constructor |
public function ArrayList()Creates a new ArrayList.
| addItem | () | method |
public function addItem(item:*):BooleanAdds an item to the list, usually at the end.
Parametersitem:* — The item.
|
Boolean — true, if the item has been added, else false.
|
| addItemAt | () | method |
public function addItemAt(index:uint, item:*):uintAdds an item at a specific position.
If the given position exceeds the array length, the item will be appended.
Parametersindex:uint — The position of the new item.
|
|
item:* — The item.
|
uint — The index of the just added item.
|
| addItemAtEnd | () | method |
public function addItemAtEnd(item:*):uintAdds an item at the end of the list.
Parametersitem:* — The item.
|
uint — list.numItems - 1.
|
| addItemAtStart | () | method |
public function addItemAtStart(item:*):uintAdds an item in front of the list.
Parametersitem:* — The item.
|
uint — 0.
|
| addItemsAt | () | method |
public function addItemsAt(index:uint, items:Array):uintAdds an array of items at a specific position.
If the given position exceeds the array length, the items will be appended.
Parametersindex:uint — The position of the first new item.
|
|
items:Array — An array of items to add.
|
uint — The index where the items have been added.
|
| clear | () | method |
public function clear():voidRemoves all items from the collection.
| countItems | () | method |
public function countItems(item:*):uintReturns the number of occurrences of an item.
Parametersitem:* |
uint — Number of occurrences of the given item.
|
| getFirstIndexOf | () | method |
public function getFirstIndexOf(item:*):intReturns the index of the first occurrence of an item.
Parametersitem:* — The item to test.
|
int — The item's first position or -1, if the item is not contained.
|
| getFirstItem | () | method |
public function getFirstItem():*Returns the first item of the sequence.
Returns* — The first item or undefined, if the list is empty.
|
| getItemAt | () | method |
public function getItemAt(index:uint):*Returns the item at the specified position.
Parametersindex:uint — The position of the item to get.
|
* — The item or undefined, if the position is invalid.
|
| getIterator | () | method |
public function getIterator(cursor:uint = 0):IIteratorReturns an iterator over the list items starting at the specified position.
Costs and order same as for the ArrayIterator.
Parameterscursor:uint (default = 0) — The start position.
|
IIterator —
The iterator.
|
See also
| getLastItem | () | method |
public function getLastItem():*Returns the last item of the sequence.
Returns* — The last item or undefined, if the list is empty.
|
| hasItem | () | method |
public function hasItem(item:*):BooleanTests, if an item is contained by the list.
Parametersitem:* — The item to test.
|
Boolean — true, if the item is contained, else false.
|
| itemRemoved | () | method |
protected function itemRemoved(item:*, index:uint):voidTemplate method to notify subclasses after an item has been removed.
Parametersitem:* — The removed item.
|
|
index:uint — The former index of the removed item.
|
| removeAll | () | method |
public function removeAll(item:*):uintRemoves all occurrences of a particular item from the list.
The items will be removed in the order they are stored.
Parametersitem:* — The item to remove completely.
|
uint — Number of items removed.
|
| removeFirstItem | () | method |
public function removeFirstItem():*Removes the first item of the sequence.
Returns* — The first item or undefined, if the list is empty.
|
| removeItem | () | method |
public function removeItem(item:*):BooleanRemoves an item from the list.
Parametersitem:* — The item to remove.
|
Boolean — true, if the item has been removed or false, if the given item is
not contained by the list.
|
| removeItemAt | () | method |
public function removeItemAt(index:uint):*Removes an item at the specified position.
Parametersindex:uint — The position of the item to remove.
|
* — The removed item or undefined, if there is no item at that position.
|
| removeItemsAt | () | method |
public function removeItemsAt(index:uint, numItems:uint):ArrayRemoves a number of items starting at the specified position.
Parametersindex:uint — The position of the first item to remove.
|
|
numItems:uint — The number of items to remove.
|
Array — An array of all removed items.
|
| removeLastItem | () | method |
public function removeLastItem():*Removes the last item of the sequence.
Returns* — The last item or undefined, if the list is empty.
|
| replaceItemAt | () | method |
public function replaceItemAt(index:uint, item:*):BooleanReplaces the item at the specified position.
If the item at the position equals the given item or the index is invalid, this method returns false and leaves the list unchanged.
Parametersindex:uint — The position of the item to replace.
|
|
item:* — The replacing item.
|
Boolean — true, if the item at that position has been replaced..
|
| reverse | () | method |
public function reverse():voidReverses the list order.
| setArray | () | method |
public function setArray(array:Array):voidSpecifies an array to be maintained by the list.
Already contained elements will be removed.
Parametersarray:Array — The array.
|
| sort | () | method |
public function sort(comparator:IComparator):voidSorts the list by the given criterion.
Parameterscomparator:IComparator — The sort criterion.
|
| toArray | () | method |
public function toArray():ArrayReturns an array of all items in the order of the particular collection.
ReturnsArray — The array.
|
| toString | () | method |
public function toString():StringInfo
ReturnsString |