List
| Kind of class: | public class |
|---|---|
| Package: | org.casalib.collection |
| Inherits from: | none |
| Implements: | |
| Known subclasses: | |
| Version: | 06/04/09 |
| Author: | Aaron Clinger, Dave Nelson |
| Classpath: | org.casalib.collection.List |
| File last modified: | Thursday, 04 June 2009, 12:40:50 |
An ordered or sequence collection that can contain duplicates. Loosely follows Java's List API.
See also:
Summary
Constructor
- List (collection:Array = null)
- Creates a new List;
Instance properties
- size : uint
- The number of elements in the list.
Instance methods
- addItem (item:*) : Boolean
- Appends the specified item to the end of this list.
- addItemAt (item:*, index:int) : Boolean
- Inserts an item as a specified position.
- addItems (items:IList) : Boolean
- Modifies original list by adding all the elements from another list.
- addItemsAt (items:IList, index:int = 0x7fffffff) : Boolean
- Modifies original list by adding all the elements from another list at a specified position.
- clear : void
- Removes all of the items from this list.
- contains (item:*) : Boolean
- Determines if this list contains a specified element.
- containsAll (items:IList) : Boolean
- Determines if this list contains all of the elements of the specified list.
- equals (list:IList) : Boolean
- Determines if the list specified in the list parameter is equal to this list object.
- getItemAt (index:uint) : *
- Returns the element at the specified position in this list.
- subList (startIndex:int = 0, endIndex:int = 16777215) : IList
- Returns a portion of this list.
- indexOf (item:*, fromIndex:int = 0) : int
- Finds the position of the first occurrence of a specified item.
- isEmpty : Boolean
- Determines if this list contains no elements.
- lastIndexOf (item:*, fromIndex:int = 0x7fffffff) : int
- Finds the position of the last occurrence of a specified item.
- removeAllInstancesOfItem (item:*) : Boolean
- Modifies the list by removing all items that are identical to the specified item.
- removeItem (item:*) : Boolean
- Removes the first occurance of the specified item in the list.
- removeItemAt (index:int) : *
- Removes the element at the specified position in this list.
- removeItems (items:IList) : Boolean
- Removes only the specified items in a list.
- retainItems (items:IList) : Boolean
- Retains only the specified items in a list.
- setItem (item:*, index:int) : *
- Replaces an item at a specified position.
- toArray : Array
- Returns an Array containing all of the elements in the list in order.
- clone : IList
- Returns a list that is an exact copy of the original list.
- toString : String
- Returns a string that represents the items in the list.
Constructor
List
public function List (
collection:Array = null)
Creates a new List;
Parameters:
collection:
An Array of items to populate the contents of this list.
Instance properties
size
public size:uint
(read)
The number of elements in the list.
Instance methods
addItem
public function addItem (
item:*) : Boolean
Appends the specified item to the end of this list.
Parameters:
item:
Element to be inserted.
Returns:
- Returns
trueif the list was changed as a result of the call; otherwisefalse.
Specified by:
addItemAt
public function addItemAt (
item:*,
index:int) : Boolean
Inserts an item as a specified position.
Parameters:
item :
Element to be inserted.
index:
Position where the elements should be added.
Returns:
- Returns
trueif the list was changed as a result of the call; otherwisefalse.
Specified by:
addItems
Modifies original list by adding all the elements from another list.
Parameters:
items:
List of elements to add.
Returns:
- Returns
trueif the list was changed as a result of the call; otherwisefalse.
Specified by:
addItemsAt
Modifies original list by adding all the elements from another list at a specified position.
Parameters:
items:
List of elements to add.
index:
Position where the elements should be added.
Returns:
- Returns
trueif the list was changed as a result of the call; otherwisefalse.
Specified by:
clear
public function clear (
) : void
Removes all of the items from this list.
Specified by:
clone
Returns a list that is an exact copy of the original list.
Returns:
- Returns a list that is an exact copy of the original list.
Specified by:
contains
public function contains (
item:*) : Boolean
Determines if this list contains a specified element.
Parameters:
item:
Element to search for.
Returns:
- Returns
trueif the list contains the element; otherwisefalse.
Specified by:
containsAll
Determines if this list contains all of the elements of the specified list.
Parameters:
items:
List of elements to be checked for containment.
Returns:
- Returns
trueif list contains all elements of the list; otherwisefalse.
Specified by:
equals
Determines if the list specified in the
list parameter is equal to this list object. Parameters:
list:
An object that implements IList.
Returns:
- Returns
trueif the object is equal to this list; otherwisefalse.
Specified by:
getItemAt
public function getItemAt (
index:uint) : *
Returns the element at the specified position in this list.
Parameters:
index:
The position of the element to return.
Returns:
- The element at the specified position in this list.
Specified by:
indexOf
public function indexOf (
item:*,
fromIndex:int = 0) : int
Finds the position of the first occurrence of a specified item.
Parameters:
item :
The element to search for.
fromIndex:
The position in the list from which to start searching for the item.
Returns:
- Returns the index of the last occurrence, or
-1if the element doesn't exist.
Specified by:
isEmpty
public function isEmpty (
) : Boolean
Determines if this list contains no elements.
Returns:
- Returns
trueif the list contains no items; otherwisefalse.
Specified by:
lastIndexOf
public function lastIndexOf (
item:*,
fromIndex:int = 0x7fffffff) : int
Finds the position of the last occurrence of a specified item.
Parameters:
item :
The element to search for.
fromIndex:
The position in the list from which to start searching for the item.
Returns:
- Returns the index of the last occurrence, or
-1if the element doesn't exist.
Specified by:
removeAllInstancesOfItem
public function removeAllInstancesOfItem (
item:*) : Boolean
Modifies the list by removing all items that are identical to the specified item.
Parameters:
item:
Element to remove.
Returns:
- Returns
trueif the list was changed as a result of the call; otherwisefalse.
Specified by:
removeItem
public function removeItem (
item:*) : Boolean
Removes the first occurance of the specified item in the list.
Parameters:
item:
Element to remove.
Returns:
- Returns
trueif the list contained the item; otherwisefalse.
Specified by:
removeItemAt
public function removeItemAt (
index:int) : *
Removes the element at the specified position in this list.
Parameters:
index:
The position of the item to removed.
Returns:
- The item previously at the specified index.
Specified by:
removeItems
Removes only the specified items in a list.
Parameters:
items:
List of elements to remove.
Returns:
- Returns
trueif the list was changed as a result of the call; otherwisefalse.
Specified by:
retainItems
Retains only the specified items in a list.
Parameters:
items:
List of elements to keep.
Returns:
- Returns
trueif the list was changed as a result of the call; otherwisefalse.
Specified by:
setItem
public function setItem (
item:*,
index:int) : *
Replaces an item at a specified position.
Parameters:
item :
The item to be stored.
index:
The index of the item to replace.
Returns:
- The element previously at the specified position.
Specified by:
subList
Returns a portion of this list.
Parameters:
startIndex:
The starting position.
endIndex :
The ending position.
Returns:
- The specified portion of the list.
Specified by:
toArray
public function toArray (
) : Array
Returns an Array containing all of the elements in the list in order.
Returns:
- Returns an Array containing all of the elements in the list in order.
Specified by:
toString
public function toString (
) : String
Returns a string that represents the items in the list.
Returns:
- Returns a string that represents the items in the list.
Specified by: