new MapIterator(map)
Converts a KeyValuePair to an iterator.
Parameters:
| Name | Type | Description |
|---|---|---|
map |
system.data.KeyValuePair | The |
- Implements:
Throws:
ReferenceError If the passed-in argument is null or not an KeyValuePair object.
Example
var map = new ArrayMap() ;
map.set("key1", "value1") ;
map.set("key2", "value2") ;
map.set("key3", "value3") ;
map.set("key1", "value1") ;
map.set("key2", "value2") ;
map.set("key3", "value3") ;
trace( '> ' + map ) ;
var it = map.iterator() ;
while( it.hasNext() )
{
trace (it.next() + " : " + it.key()) ;
if( it.key() === "key2" )
{
it.delete() ;
}
}
trace( '> ' + map ) ;
Methods
-
delete()
-
Deletes from the underlying collection the last element returned by the iterator (optional operation).
- Implements:
-
hasNext()
-
Returns
trueif the iteration has more elements.- Implements:
Returns:
trueif the iteration has more elements. -
key()
-
Returns the current key of the internal pointer of the iterator (optional operation).
- Implements:
Returns:
the current key of the internal pointer of the iterator (optional operation).
-
next()
-
Returns the next element in the iteration.
- Implements:
Returns:
the next element in the iteration.
-
reset()
-
Reset the internal pointer of the iterator (optional operation).
- Implements:
-
seek()
-
Changes the position of the internal pointer of the iterator (optional operation).
- Implements: