Packageorg.as3collections
Interfacepublic interface IListMapIterator extends IIterator
Implementors ListMapIterator

An iterator for maps that allows the programmer to traverse the map in either direction, modify the map during iteration, and obtain the iterator's current position in the map.

Note that the remove and set methods are defined to operate on the last mapping returned by a call to next or previous.



Public Methods
 MethodDefined By
 Inherited
hasNext():Boolean
Returns true if the iteration has more elements.
IIterator
  
hasPrevious():Boolean
Returns true if the iteration has more mappings when traversing the map in the reverse direction.
IListMapIterator
 Inherited
next():*
Returns the next element in the iteration.
IIterator
  
nextIndex():int
Returns the index of the mapping that would be returned by a subsequent call to next.
IListMapIterator
 Inherited
Returns the internal pointer of the iteration.
IIterator
  
Returns the previous mapping in the iteration.
IListMapIterator
  
Returns the index of the mapping that would be returned by a subsequent call to previous.
IListMapIterator
  
put(key:*, value:*):void
Associates the specified value with the specified key in this map.
IListMapIterator
 Inherited
remove():void
Removes from the underlying collection the last element returned by the iterator (optional operation).
IIterator
 Inherited
reset():void
Resets the internal pointer of the iterator.
IIterator
  
set(key:*, value:*):void
Replaces the last mapping returned by next or previous with the specified mapping (optional operation).
IListMapIterator
Method Detail
hasPrevious()method
public function hasPrevious():Boolean

Returns true if the iteration has more mappings when traversing the map in the reverse direction.

Returns
Booleantrue if the iteration has more mappings when traversing the map in the reverse direction.
nextIndex()method 
public function nextIndex():int

Returns the index of the mapping that would be returned by a subsequent call to next. (Returns map size if the map iterator is at the end of the map.)

Returns
int — the index of the mapping that would be returned by a subsequent call to next, or map size if map iterator is at end of map.
previous()method 
public function previous():*

Returns the previous mapping in the iteration.

Returns
* — the previous mapping in the iteration.

Throws
NoSuchElementError — if the iteration has no previous mappings.
 
ConcurrentModificationError — if the map was changed directly (without using the iterator) during iteration.
previousIndex()method 
public function previousIndex():int

Returns the index of the mapping that would be returned by a subsequent call to previous. (Returns -1 if the map iterator is at the beginning of the map.)

Returns
int — the index of the mapping that would be returned by a subsequent call to previous, or -1 if map iterator is at beginning of map.
put()method 
public function put(key:*, value:*):void

Associates the specified value with the specified key in this map. (optional operation) The mapping is inserted immediately before the next mapping that would be returned by next, if any, and after the next mapping that would be returned by previous, if any. (If the map contains no mappings, the new mapping becomes the sole mapping on the map.) The new mapping is inserted before the implicit cursor: a subsequent call to next would be unaffected, and a subsequent call to previous would return the new mapping. (This call increases by one the value that would be returned by a call to nextIndex or previousIndex.)

Parameters

key:* — key with which the specified value is to be associated.
 
value:* — value to be associated with the specified key.


Throws
ConcurrentModificationError — if the map was changed directly (without using the iterator) during iteration.
 
ArgumentError — if the map already contains the specified key.
set()method 
public function set(key:*, value:*):void

Replaces the last mapping returned by next or previous with the specified mapping (optional operation). This call can be made only if neither IListMapIterator.remove nor IListMapIterator.add have been called after the last call to next or previous.

Parameters

key:* — key with which the specified value is to be associated.
 
value:* — value to be associated with the specified key.


Throws
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.
 
ArgumentError — if the map already contains the specified key and it is not the replaced key.