Packagesystem.data.iterators
Classpublic class LinkedListIterator
InheritanceLinkedListIterator Inheritance Object
Implements ListIterator

Converts a 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
     



Public Methods
 MethodDefined 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
  
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
  
Returns the previous element in the collection.
LinkedListIterator
  
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
Constructor Detail
LinkedListIterator()Constructor
public function LinkedListIterator(list:LinkedList, index:uint = 0)

Creates a new LinkedListIterator instance.

Parameters
list:LinkedList — The position of the internal pointer of this Iterator
 
index:uint (default = 0) — The owner LinkedList of this iterator.
Method Detail
add()method
public function add(o:*):void

Inserts 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():void

This 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.

Returns
Booleantrue if the iteration has more elements.
hasPrevious()method 
public function hasPrevious():Boolean

Checks 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() ) ;
         

Returns
Boolean
key()method 
public function key():*

Illegal operation in this iterator, uses nextIndex() and previousIndex() method.

Returns
*

Throws
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():uint

Returns the index of the element that would be returned by a subsequent call to next.

Returns
uint — 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():int

Returns the index of the element that would be returned by a subsequent call to previous.

Returns
int — 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():void

Reset the internal pointer of the iterator (optional operation).

seek()method 
public function seek(position:*):void

Change the position of the internal pointer of the iterator (optional operation).

Parameters

position:*

set()method 
public function set(o:*):void

Replaces the last element returned by next or previous with the specified element (optional operation).

Parameters

o:*