Package | org.spicefactory.lib.collection |
Class | public class List |
Inheritance | List flash.utils.Proxy |
The List
class supports for
and for each
loops
as well as bracket access for reading and writing values.
Method | Defined By | ||
---|---|---|---|
List(items:Array = null)
Creates a new instance. | List | ||
add(item:*):void
Adds the specified item to this list, appending it as the last item. | List | ||
Clones this list. | List | ||
contains(item:*):Boolean
Indicates whether this list contains the specified item. | List | ||
getFirst():*
Returns the first item from this list. | List | ||
getLast():*
Returns the last item from this list. | List | ||
indexOf(item:*):int
Returns the index of the specified item or -1 if it is not in this list. | List | ||
insert(index:uint, item:*):void
Inserts a new item at the specified index. | List | ||
isEmpty():Boolean
Indicates whether this list is empty. | List | ||
remove(item:*):Boolean
Removes the specified item from this list. | List | ||
removeAll():void
Removes all items from this list. | List | ||
removeAt(index:uint):*
Removes and returns the item at the specified index. | List | ||
removeFirst():*
Removes and returns the first item from this list. | List | ||
removeLast():*
Removes and returns the last item from this list. | List | ||
size():uint
Returns the number of items in this list. | List | ||
sort(compareFunction:Function, options:uint = 0):void
Sorts the elements in this list, delegating to the sort method
of the underlying Array. | List | ||
sortOn(propertyNames:Array, options:uint):void
Sorts the elements in this list according to the values of the specified
properties, delegating to the sortOn method of the underlying Array. | List | ||
toArray():Array
Returns the items of this list as an Array. | List |
List | () | Constructor |
public function List(items:Array = null)
Creates a new instance.
Parametersitems:Array (default = null ) — the items to populate the list with
|
add | () | method |
public function add(item:*):void
Adds the specified item to this list, appending it as the last item.
Parameters
item:* — the item to add to this list
|
clone | () | method |
public function clone():List
Clones this list. Modifications in the clone are not reflected in the original list and vice versa.
ReturnsList — a clone of this list
|
contains | () | method |
public function contains(item:*):Boolean
Indicates whether this list contains the specified item.
Parameters
item:* — the item to check
|
Boolean — true if this list contains the specified item
|
getFirst | () | method |
public function getFirst():*
Returns the first item from this list.
Returns* — the first item in this list
|
getLast | () | method |
public function getLast():*
Returns the last item from this list.
Returns* — the last item in this list
|
indexOf | () | method |
public function indexOf(item:*):int
Returns the index of the specified item or -1 if it is not in this list.
Parameters
item:* — the item to return the index for
|
int — the index of the specified item or -1 if it is not in this list
|
insert | () | method |
public function insert(index:uint, item:*):void
Inserts a new item at the specified index.
Parameters
index:uint — the 0-based index to insert the item at
| |
item:* — the item to insert
|
isEmpty | () | method |
public function isEmpty():Boolean
Indicates whether this list is empty.
ReturnsBoolean — true if this list does not contain any items.
|
remove | () | method |
public function remove(item:*):Boolean
Removes the specified item from this list.
Parameters
item:* — the item to remove from this list
|
Boolean — true if this list contained the specified item
|
removeAll | () | method |
public function removeAll():void
Removes all items from this list.
removeAt | () | method |
public function removeAt(index:uint):*
Removes and returns the item at the specified index.
Parameters
index:uint — the index to remove an item at
|
* — the removed item
|
removeFirst | () | method |
public function removeFirst():*
Removes and returns the first item from this list.
Returns* — the removed item
|
removeLast | () | method |
public function removeLast():*
Removes and returns the last item from this list.
Returns* — the removed item
|
size | () | method |
public function size():uint
Returns the number of items in this list.
Returnsuint — the number of items in this list
|
sort | () | method |
public function sort(compareFunction:Function, options:uint = 0):void
Sorts the elements in this list, delegating to the sort method of the underlying Array.
Parameters
compareFunction:Function — a comparison function as expected by Array.sort
| |
options:uint (default = 0 ) — one or more options as accepted by Array.sort
|
sortOn | () | method |
public function sortOn(propertyNames:Array, options:uint):void
Sorts the elements in this list according to the values of the specified properties, delegating to the sortOn method of the underlying Array.
Parameters
propertyNames:Array — a list of property names with the first element representing the primary sort field
| |
options:uint — one or more options as accepted by Array.sortOn
|
toArray | () | method |
public function toArray():Array
Returns the items of this list as an Array.
ReturnsArray — the items of this list as an Array
|