| Package | system.data.iterators |
| Class | public class LinkedListIterator |
| Inheritance | LinkedListIterator Object |
| Implements | ListIterator |
LinkedList to a specific ListIterator.
Example :
import system.data.lists.LinkedList ;
import system.data.ListIterator ;
var list:LinkedList = new LinkedList() ;
list.add("item1") ;
list.add("item2") ;
list.add("item3") ;
var it:ListIterator = list.listIterator(2) ;
trace( it.hasPrevious() + " : " + it.previous() ) ; // true : item2
| Method | Defined By | ||
|---|---|---|---|
LinkedListIterator(list:LinkedList, index:uint = 0)
Creates a new LinkedListIterator instance. | LinkedListIterator | ||
add(o:*):void
Inserts the specified element into the list (optional operation). | LinkedListIterator | ||
checkForComodification():void
This method check the comodification of the LinkedList and test if the iterator is valid and can continue to process. | LinkedListIterator | ||
hasNext():Boolean
Returns true if the iteration has more elements. | LinkedListIterator | ||
hasPrevious():Boolean
Checks to see if there is a previous element that can be iterated to. | LinkedListIterator | ||
key():*
Illegal operation in this iterator, uses nextIndex() and previousIndex() method. | LinkedListIterator | ||
next():*
Returns the next element in the iteration. | LinkedListIterator | ||
nextIndex():uint
Returns the index of the element that would be returned by a subsequent call to next. | LinkedListIterator | ||
previous():*
Returns the previous element in the collection. | LinkedListIterator | ||
previousIndex():int
Returns the index of the element that would be returned by a subsequent call to previous. | LinkedListIterator | ||
remove():*
Removes from the underlying collection the last element returned by the iterator (optional operation). | LinkedListIterator | ||
reset():void
Reset the internal pointer of the iterator (optional operation). | LinkedListIterator | ||
seek(position:*):void
Change the position of the internal pointer of the iterator (optional operation). | LinkedListIterator | ||
set(o:*):void
Replaces the last element returned by next or previous with the specified element (optional operation). | LinkedListIterator | ||
| LinkedListIterator | () | Constructor |
public function LinkedListIterator(list:LinkedList, index:uint = 0)Creates a new LinkedListIterator instance.
Parameterslist:LinkedList — The position of the internal pointer of this Iterator
| |
index:uint (default = 0) — The owner LinkedList of this iterator.
|
| add | () | method |
public function add(o:*):voidInserts the specified element into the list (optional operation).
Example :
import system.data.ListIterator ;
import system.data.lists.LinkedList ;
var list:LinkedList = new LinkedList() ;
list.add("item1") ;
list.add("item2") ;
list.add("item3") ;
var it:ListIterator = list.listIterator(1) ;
it.insert("item0") ;
trace(list) ;
Attention : Dont' use this method in a loop with hasPrevious() and previous() method.
Parameters
o:* |
| checkForComodification | () | method |
public function checkForComodification():voidThis method check the comodification of the LinkedList and test if the iterator is valid and can continue to process.
| hasNext | () | method |
public function hasNext():Boolean
Returns true if the iteration has more elements.
Boolean — true if the iteration has more elements.
|
| hasPrevious | () | method |
public function hasPrevious():BooleanChecks to see if there is a previous element that can be iterated to.
Example :
import system.data.ListIterator ;
import system.data.lists.LinkedList ;
var list:LinkedList = new LinkedList() ;
list.add("item1") ;
list.add("item2") ;
list.add("item3") ;
var it:ListIterator = list.listIterator( 2 ) ;
trace( it.hasPrevious() ) ;
ReturnsBoolean |
| key | () | method |
public function key():*Illegal operation in this iterator, uses nextIndex() and previousIndex() method.
Returns* |
IllegalOperationError — if the user call this method, this method is unsupported.
|
| next | () | method |
public function next():*Returns the next element in the iteration.
Returns* — the next element in the iteration.
|
| nextIndex | () | method |
public function nextIndex():uintReturns the index of the element that would be returned by a subsequent call to next.
Returnsuint — the index of the element that would be returned by a subsequent call to next.
|
| previous | () | method |
public function previous():*Returns the previous element in the collection.
Returns* — the previous element in the collection.
|
| previousIndex | () | method |
public function previousIndex():intReturns the index of the element that would be returned by a subsequent call to previous.
Returnsint — the index of the element that would be returned by a subsequent call to previous.
|
| remove | () | method |
public function remove():*Removes from the underlying collection the last element returned by the iterator (optional operation).
Returns* |
| reset | () | method |
public function reset():voidReset the internal pointer of the iterator (optional operation).
| seek | () | method |
public function seek(position:*):voidChange the position of the internal pointer of the iterator (optional operation).
Parameters
position:* |
| set | () | method |
public function set(o:*):voidReplaces the last element returned by next or previous with the specified element (optional operation).
Parameters
o:* |