Packagetwaver
Classpublic class Collection
InheritanceCollection Inheritance Object
Implements ICollection

This is the default implementation of interface ICollection.



Public Properties
 PropertyDefined By
  count : int
[read-only] Get the total object count of this collection.
Collection
  duplicatable : Boolean
Get the flag value indicates that whether objects contain in this collection can be duplicatable.
Collection
Public Methods
 MethodDefined By
  
Collection(source:* = null)
Constructor
Collection
  
addAll(collection:ICollection):void
Add all objects of given collection into this collection.
Collection
  
addItem(item:*):void
Add an object item into this collection.
Collection
  
addItemAt(item:*, index:int):void
Add an object item into this collection at the specified index location.
Collection
  
clear():void
Clear all items of this collection.
Collection
  
contains(item:*):Boolean
Check whether this collection contains the specified object.
Collection
  
forEach(callbackFunction:Function):void
Iterates all data of this collection by specified call back function.
Collection
  
forEachReverse(callbackFunction:Function):void
Iterates all data of this collection by specified call back function in the reversed order.
Collection
  
getItemAt(index:int):*
Get the object at the specified location from this collection.
Collection
  
getItemIndex(item:*):int
Get the specified object item's index, if this collection contains it.
Collection
  
removeItem(item:*):int
Remove the specified object from this collection.
Collection
  
removeItemAt(index:int):*
Remove the item at the specified location.
Collection
  
setItemAt(item:*, index:int):*
Set the object at the specified location with the specified new item object.
Collection
  
sort(sortFunction:Function = null):ICollection
Collection
  
toArray():Array
Get all objects in this collection with an Array.
Collection
  
toCollection(filterFunction:Function):ICollection
Collection
  
toString():String
Collection
Property Detail
countproperty
count:int  [read-only]

Get the total object count of this collection.


Implementation
    public function get count():int
duplicatableproperty 
duplicatable:Boolean

Get the flag value indicates that whether objects contain in this collection can be duplicatable.


Implementation
    public function get duplicatable():Boolean
    public function set duplicatable(value:Boolean):void
Constructor Detail
Collection()Constructor
public function Collection(source:* = null)

Constructor

Parameters
source:* (default = null) — source data of this collection.
Method Detail
addAll()method
public function addAll(collection:ICollection):void

Add all objects of given collection into this collection.

Parameters

collection:ICollection — the collection that to be added into this collection.

addItem()method 
public function addItem(item:*):void

Add an object item into this collection.

Parameters

item:* — the item to be added.

addItemAt()method 
public function addItemAt(item:*, index:int):void

Add an object item into this collection at the specified index location.

Parameters

item:* — the object item to be added into this collection.
 
index:int — the index location this item should added.

clear()method 
public function clear():void

Clear all items of this collection. All objects will be removed.

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

Check whether this collection contains the specified object.

Parameters

item:* — the object to be checked.

Returns
Boolean — true if contains this item, false otherwise.
forEach()method 
public function forEach(callbackFunction:Function):void

Iterates all data of this collection by specified call back function.

Parameters

callbackFunction:Function — the call back function used to iterate all items contained by this collection.

forEachReverse()method 
public function forEachReverse(callbackFunction:Function):void

Iterates all data of this collection by specified call back function in the reversed order.

Parameters

callbackFunction:Function — the call back function used to iterate items contained by this collection.

getItemAt()method 
public function getItemAt(index:int):*

Get the object at the specified location from this collection.

Parameters

index:int — the index location that need to get.

Returns
* — the object item at the specified index location.
getItemIndex()method 
public function getItemIndex(item:*):int

Get the specified object item's index, if this collection contains it.

Parameters

item:* — an object item to be checked.

Returns
int — the index location of the specified item. If this item does not contained in this collection, return -1.
removeItem()method 
public function removeItem(item:*):int

Remove the specified object from this collection.

Parameters

item:* — the object to be removed

Returns
int — index location of the removed item.
removeItemAt()method 
public function removeItemAt(index:int):*

Remove the item at the specified location.

Parameters

index:int — the index location where the object need to remove

Returns
* — the object that removed.
setItemAt()method 
public function setItemAt(item:*, index:int):*

Set the object at the specified location with the specified new item object.

Parameters

item:* — the new object value of this location.
 
index:int — the location that need to set.

Returns
* — the old object value.
sort()method 
public function sort(sortFunction:Function = null):ICollection

Parameters

sortFunction:Function (default = null)

Returns
ICollection
toArray()method 
public function toArray():Array

Get all objects in this collection with an Array.

Returns
Array — an Array object that contains all data of this collection.
toCollection()method 
public function toCollection(filterFunction:Function):ICollection

Parameters

filterFunction:Function

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

Returns
String