|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
K - The type of the keys.D - The type of the data.public interface Iterator<K,D>
An iterator allows to iterate over all entries of a Map.
E.g., the following code prints all entries of a Map to stdout.
Iteratori = someMap.iterator(); while (i.more()) { System.out.println(i.key() + " -> " + i.data()); i.step(); } // or equivalently, for (i=someMap.iterator(); i.more(); i.step()) { System.out.println(i.key() + " -> " + i.data()); }
Map,
Map.iterator()| Method Summary | |
|---|---|
D |
data()
Returns the data of the current entry, if it is valid, cf. |
K |
key()
Returns the key of the current entry, if it is valid, cf. |
boolean |
more()
Test whether the current entry is valid. |
void |
step()
Move to the next entry. |
| Method Detail |
|---|
void step()
boolean more()
K key()
more().
D data()
more().
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||