Packageorg.as3collections
Interfacepublic interface IList extends ICollection, IIterable, org.as3coreaddendum.system.ICloneable, org.as3coreaddendum.system.IEquatable
Implementors AbstractList, TypedList, UniqueList

An ordered collection. The user of this interface has precise control over where in the list each element is inserted. The user can access elements by their integer index (position in the list), and search for elements in the list.

Lists typically allow duplicate elements and multiple null elements if they allow null elements at all. But there are lists that prohibits duplicates and/or null elements, by throwing runtime errors when the user attempts to insert them.

The IList interface provides the special IListIterator iterator, that allows element insertion and replacement, and bidirectional access in addition to the normal operations that the IIterator interface provides. The listIterator() method is provided to obtain a IListIterator implementation that may start at a specified position in the list.

The methods that modify the list are specified to throw org.as3coreaddendum.errors.UnsupportedOperationError if the list does not support the operation. These methods are documented as "optional operation".

This documentation is partially based in the Java Collections Framework JavaDoc documentation. For further information see Java Collections Framework

See also

AbstractList
ICollection
ISortedList
IListIterator


Public Properties
 PropertyDefined By
 InheritedallEquatable : Boolean
[read-only] Indicates whether all elements in this collection implement the interface org.as3coreaddendum.system.IEquatable.
ICollection
  modCount : int
[read-only] The number of times this list has been structurally modified.
IList
Public Methods
 MethodDefined By
 Inherited
add(element:*):Boolean
Ensures that this collection contains the specified element (optional operation).
ICollection
 Inherited
addAll(collection:ICollection):Boolean
Adds all of the elements in the specified collection to this collection (optional operation).
ICollection
  
addAllAt(index:int, collection:ICollection):Boolean
Inserts all of the elements in the specified collection into this list at the specified position (optional operation).
IList
  
addAt(index:int, element:*):Boolean
Inserts the specified element at the specified position in this list (optional operation).
IList
 Inherited
clear():void
Removes all of the elements from this collection (optional operation).
ICollection
 Inherited
contains(o:*):Boolean
Returns true if this collection contains the specified object.
ICollection
 Inherited
containsAll(collection:ICollection):Boolean
Returns true if this collection contains all of the elements in the specified collection.
ICollection
  
getAt(index:int):*
Returns the element at the specified position in this list.
IList
  
indexOf(element:*, fromIndex:int = 0):int
Returns the index of the first occurrence of the specified element in this list, or -1 if this list does not contain the element.
IList
 Inherited
isEmpty():Boolean
Returns true if this collection contains no elements.
ICollection
 Inherited
Returns an iterator over a set of elements.
IIterable
  
lastIndexOf(element:*, fromIndex:int = 0x7fffffff):int
Returns the index of the last occurrence of the specified element in this list, or -1 if this list does not contain the element.
IList
  
Returns a list iterator of the elements in this list (in proper sequence), starting at the specified position in this list.
IList
 Inherited
remove(o:*):Boolean
Removes a single instance (only one occurrence) of the specified object from this collection, if it is present (optional operation).
ICollection
 Inherited
removeAll(collection:ICollection):Boolean
Removes all elements of this collection that are also contained in the specified collection (optional operation).
ICollection
  
removeAt(index:int):*
Removes the element at the specified position in this list (optional operation).
IList
  
removeRange(fromIndex:int, toIndex:int):ICollection
Removes all of the elements whose index is between fromIndex, inclusive, and toIndex, exclusive (optional operation).
IList
 Inherited
retainAll(collection:ICollection):Boolean
Retains only the elements in this collection that are contained in the specified collection (optional operation).
ICollection
  
reverse():void
Reverses the order of the elements in this list.
IList
  
setAt(index:int, element:*):*
Replaces the element at the specified position in this list with the specified element (optional operation).
IList
 Inherited
size():int
Returns the number of elements in this collection.
ICollection
  
subList(fromIndex:int, toIndex:int):IList
Returns a new list that is a view of the portion of this list between the specified fromIndex, inclusive, and toIndex, exclusive.
IList
 Inherited
toArray():Array
Returns an array containing all of the elements in this collection.
ICollection
Property Detail
modCountproperty
modCount:int  [read-only]

The number of times this list has been structurally modified. Structural modifications are those that change the size of the list.

This field is used by the list iterator implementation returned by the listIterator method. If the value of this field changes unexpectedly, the list iterator will throw a org.as3collections.errors.ConcurrentModificationError in response to the next, remove, previous, set or add operations.

Implementations merely has to increment this field in its add, remove and any other methods that result in structural modifications to the list. A single call to add or remove must add no more than one to this field.


Implementation
    public function get modCount():int
Method Detail
addAllAt()method
public function addAllAt(index:int, collection:ICollection):Boolean

Inserts all of the elements in the specified collection into this list at the specified position (optional operation). Shifts the element currently at that position (if any) and any subsequent elements to the right (increases their indices). The new elements will appear in this list in the order that they are returned by the specified collection's iterator.

Parameters

index:int — index at which to insert the first element from the specified collection.
 
collection:ICollection — the collection containing elements to be added to this list.

Returns
Booleantrue if this list changed as a result of the call.

Throws
org.as3coreaddendum.errors:UnsupportedOperationError — if the addAllAt operation is not supported by this list.
 
org.as3coreaddendum.errors:ClassCastError — if the class of an element of the specified collection prevents it from being added to this list.
 
ArgumentError — if the specified collection contains a null element and this list does not permit null elements, or if the specified collection is null.
 
IndexOutOfBoundsError — if the index is out of range (index < 0 || index > size()).
addAt()method 
public function addAt(index:int, element:*):Boolean

Inserts the specified element at the specified position in this list (optional operation). Shifts the element currently at that position (if any) and any subsequent elements to the right (adds one to their indices).

Parameters

index:int — index at which the specified element is to be inserted.
 
element:* — the element to be added.

Returns
Booleantrue if this list changed as a result of the call. Returns false if this list does not permit duplicates and already contains the specified element.

Throws
org.as3coreaddendum.errors:UnsupportedOperationError — if the addAt operation is not supported by this list.
 
org.as3coreaddendum.errors:ClassCastError — if the class of the specified element prevents it from being added to this list.
 
ArgumentError — if the specified element is null and this list does not permit null elements.
 
IndexOutOfBoundsError — if the index is out of range (index < 0 || index > size()).
getAt()method 
public function getAt(index:int):*

Returns the element at the specified position in this list.

Parameters

index:int — index of the element to return.

Returns
* — the element at the specified position in this list.

Throws
IndexOutOfBoundsError — if the index is out of range (index < 0 || index >= size()).
indexOf()method 
public function indexOf(element:*, fromIndex:int = 0):int

Returns the index of the first occurrence of the specified element in this list, or -1 if this list does not contain the element.

Parameters

element:* — the element to search for.
 
fromIndex:int (default = 0) — the position in the list from which to start searching for the element (inclusive).

Returns
int — the index of the first occurrence of the specified element in this list, or -1 if this list does not contain the element.

Throws
org.as3coreaddendum.errors:ClassCastError — if the class of the specified element is incompatible with this list (optional).
 
ArgumentError — if the specified element is null and this list does not permit null elements (optional).
lastIndexOf()method 
public function lastIndexOf(element:*, fromIndex:int = 0x7fffffff):int

Returns the index of the last occurrence of the specified element in this list, or -1 if this list does not contain the element.

Parameters

element:* — the element to search for.
 
fromIndex:int (default = 0x7fffffff) — the position in the list from which to start searching for the element (inclusive). The default is the maximum value allowed for an index. If you do not specify fromIndex, the search starts at the last item in the list.

Returns
int — the index of the last occurrence of the specified element in this list, or -1 if this list does not contain the element.

Throws
org.as3coreaddendum.errors:ClassCastError — if the class of the specified element is incompatible with this list (optional).
 
ArgumentError — if the specified element is null and this list does not permit null elements (optional).
listIterator()method 
public function listIterator(index:int = 0):IListIterator

Returns a list iterator of the elements in this list (in proper sequence), starting at the specified position in this list. The specified index indicates the first element that would be returned by an initial call to next. An initial call to previous would return the element with the specified index minus one.

Parameters

index:int (default = 0) — index of first element to be returned from the list iterator (by a call to the next method)

Returns
IListIterator — a list iterator of the elements in this list (in proper sequence), starting at the specified position in this list.

See also

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

Removes the element at the specified position in this list (optional operation). Shifts any subsequent elements to the left (subtracts one from their indices). Returns the element that was removed from the list.

Parameters

index:int — the index of the element to be removed.

Returns
* — the element previously at the specified position.

Throws
org.as3coreaddendum.errors:UnsupportedOperationError — if the removeAt operation is not supported by this list.
 
IndexOutOfBoundsError — if the index is out of range (index < 0 || index >= size()).
removeRange()method 
public function removeRange(fromIndex:int, toIndex:int):ICollection

Removes all of the elements whose index is between fromIndex, inclusive, and toIndex, exclusive (optional operation). Shifts any subsequent elements to the left (subtracts their indices).

If toIndex == fromIndex, this operation has no effect.

Parameters

fromIndex:int — the index to start removing elements (inclusive).
 
toIndex:int — the index to stop removing elements (exclusive).

Returns
ICollection — a new collection containing all the removed elements.

Throws
org.as3coreaddendum.errors:UnsupportedOperationError — if the removeRange operation is not supported by this list.
 
IndexOutOfBoundsError — if fromIndex or toIndex is out of range (index < 0 || index > size()).
reverse()method 
public function reverse():void

Reverses the order of the elements in this list.

setAt()method 
public function setAt(index:int, element:*):*

Replaces the element at the specified position in this list with the specified element (optional operation).

Parameters

index:int — index of the element to replace.
 
element:* — element to be stored at the specified position.

Returns
* — the element previously at the specified position.

Throws
org.as3coreaddendum.errors:UnsupportedOperationError — if the setAt operation is not supported by this list.
 
org.as3coreaddendum.errors:ClassCastError — if the class of the specified element prevents it from being added to this list.
 
ArgumentError — if the specified element is null and this list does not permit null elements.
 
IndexOutOfBoundsError — if the index is out of range (index < 0 || index >= size()).
subList()method 
public function subList(fromIndex:int, toIndex:int):IList

Returns a new list that is a view of the portion of this list between the specified fromIndex, inclusive, and toIndex, exclusive.

The returned list supports all of the optional list operations supported by this list.

Parameters

fromIndex:int — the index to start retrieving elements (inclusive).
 
toIndex:int — the index to stop retrieving elements (exclusive).

Returns
IList — a new list that is a view of the specified range within this list.

Throws
org.as3coreaddendum.errors:UnsupportedOperationError — if the subList operation is not supported by this list.
 
IndexOutOfBoundsError — if fromIndex or toIndex is out of range (index < 0 || index > size()).