Package | org.as3collections |
Interface | public interface IListIterator extends IIterator |
Implementors | ListIterator |
Note that the remove
and set
methods are defined to operate on the last element returned by a call to next
or previous
.
Method | Defined By | ||
---|---|---|---|
add(element:*):Boolean
Inserts the specified element into the list (optional operation). | IListIterator | ||
hasNext():Boolean
Returns true if the iteration has more elements. | IIterator | ||
hasPrevious():Boolean
Returns true if the iteration has more elements when traversing the list in the reverse direction. | IListIterator | ||
next():*
Returns the next element in the iteration. | IIterator | ||
nextIndex():int
Returns the index of the element that would be returned by a subsequent call to next. | IListIterator | ||
pointer():*
Returns the internal pointer of the iteration. | IIterator | ||
previous():*
Returns the previous element in the iteration. | IListIterator | ||
previousIndex():int
Returns the index of the element that would be returned by a subsequent call to previous. | IListIterator | ||
remove():void
Removes from the underlying collection the last element returned by the iterator (optional operation). | IIterator | ||
reset():void
Resets the internal pointer of the iterator. | IIterator | ||
set(element:*):void
Replaces the last element returned by next or previous with the specified element (optional operation). | IListIterator |
add | () | method |
public function add(element:*):Boolean
Inserts the specified element into the list (optional operation). The element is inserted immediately before the next element that would be returned by next
, if any, and after the next element that would be returned by previous
, if any. (If the list contains no elements, the new element becomes the sole element on the list.) The new element is inserted before the implicit cursor: a subsequent call to next
would be unaffected, and a subsequent call to previous
would return the new element. (This call increases by one the value that would be returned by a call to nextIndex
or previousIndex
.)
Parameters
element:* — the element to add.
|
Boolean — true if the list has changed as a result of the call. Returns false if the list does not permit duplicates and already contains the specified element.
|
ConcurrentModificationError — if the list was changed directly (without using the iterator) during iteration.
|
hasPrevious | () | method |
public function hasPrevious():Boolean
Returns true
if the iteration has more elements when traversing the list in the reverse direction.
Boolean — true if the iteration has more elements when traversing the list in the reverse direction.
|
nextIndex | () | method |
public function nextIndex():int
Returns the index of the element that would be returned by a subsequent call to next
. (Returns list size if the list iterator is at the end of the list.)
int — the index of the element that would be returned by a subsequent call to next , or list size if list iterator is at end of list.
|
previous | () | method |
public function previous():*
Returns the previous element in the iteration.
Returns* — the previous element in the iteration.
|
NoSuchElementError — if the iteration has no previous elements.
| |
ConcurrentModificationError — if the list was changed directly (without using the iterator) during iteration.
|
previousIndex | () | method |
public function previousIndex():int
Returns the index of the element that would be returned by a subsequent call to previous
. (Returns -1 if the list iterator is at the beginning of the list.)
int — the index of the element that would be returned by a subsequent call to previous , or -1 if list iterator is at beginning of list.
|
set | () | method |
public function set(element:*):void
Replaces the last element returned by next
or previous
with the specified element (optional operation). This call can be made only if neither IListIterator.remove
nor IListIterator.add
have been called after the last call to next
or previous
.
Parameters
element:* — the element with which to replace the last element returned by next or previous .
|
org.as3coreaddendum.errors:UnsupportedOperationError — if the set operation is not supported by this iterator.
| |
org.as3coreaddendum.errors:ClassCastError — if the class of the specified element prevents it from being added to this list.
| |
org.as3coreaddendum.errors:IllegalStateError — if neither next or previous have been called, or remove or add have been called after the last call to next or previous .
|