Package | org.as3collections |
Interface | public interface IList extends ICollection, IIterable, org.as3coreaddendum.system.ICloneable, org.as3coreaddendum.system.IEquatable |
Implementors | AbstractList, TypedList, UniqueList |
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
Property | Defined By | ||
---|---|---|---|
allEquatable : 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 |
Method | Defined By | ||
---|---|---|---|
add(element:*):Boolean
Ensures that this collection contains the specified element (optional operation). | ICollection | ||
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 | ||
clear():void
Removes all of the elements from this collection (optional operation). | ICollection | ||
contains(o:*):Boolean
Returns true if this collection contains the specified object. | ICollection | ||
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 | ||
isEmpty():Boolean
Returns true if this collection contains no elements. | ICollection | ||
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 | ||
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. | IList | ||
remove(o:*):Boolean
Removes a single instance (only one occurrence) of the specified object from this collection, if it is present (optional operation). | ICollection | ||
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 | ||
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 | ||
size():int
Returns the number of elements in this collection. | ICollection | ||
Returns a new list that is a view of the portion of this list between the specified fromIndex, inclusive, and toIndex, exclusive. | IList | ||
toArray():Array
Returns an array containing all of the elements in this collection. | ICollection |
modCount | property |
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.
public function get modCount():int
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.
|
Boolean — true if this list changed as a result of the call.
|
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.
|
Boolean — true 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.
|
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.
|
* — the element at the specified position in this list.
|
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).
|
int — the index of the first occurrence of the specified element in this list, or -1 if this list does not contain the element.
|
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.
|
int — the index of the last occurrence of the specified element in this list, or -1 if this list does not contain the element.
|
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)
|
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.
|
* — the element previously at the specified position.
|
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).
|
ICollection — a new collection containing all the removed elements.
|
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.
|
* — the element previously at the specified position.
|
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).
|
IList — a new list that is a view of the specified range within this list.
|
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()) .
|