Class org.as2lib.data.holder.map.ValueMapIterator

org.as2lib.core.BasicClass
   +--org.as2lib.data.holder.map.ValueMapIterator

Implemented Interfaces

Iterator

Description

ValueMapIterator is used to iterate over the values of a map.

This iterator is quite simple to use. There is one method to check whether there are more elements left to iterate over hasNext, one method to get the next element next and one to remove the current element remove.

Example: var map:Map = new HashMap(); map.put("key1", 1); map.put("key2", 2); map.put("key3", 3); var iterator:Iterator = new ValueMapIterator(map); while (iterator.hasNext()) { trace(iterator.next()); }

You normally do not use this class directly, but obtain an iterator that iterates over the values of a map using the Map.valueIterator method. The returned iterator can, but does not have to be an instance of this class.

Example: var map:Map = new HashMap(); // ... var iterator:Iterator = map.valueIterator(); // ...

Method Index

new ValueMapIterator()

hasNext(), next(), remove()

Inherited from BasicClass

toString()

Constructor Detail

ValueMapIterator

public function ValueMapIterator(target:Map)

Constructs a new ValueMapIterator instance.

Parameters

targetthe map to iterate over

Throws

IllegalArgumentExceptionif the passed-in target map is null or undefined

Method Detail

hasNext

public function hasNext(Void):Boolean

Returns whether there exists another value to iterate over.

Return

true if there is at least one value left to iterate over

Specified By

hasNext() in org.as2lib.data.holder.Iterator

next

public function next(Void)

Returns the next value.

Return

the next value

Throws

NoSuchElementExceptionif there is no next value

Specified By

next() in org.as2lib.data.holder.Iterator

remove

public function remove(Void):Void

Removes the currently selected key-value pair from this iterator and from the map this iterator iterates over.

Throws

IllegalStateExceptionif you try to remove a key-value pair when none is selected

Specified By

remove() in org.as2lib.data.holder.Iterator