Iterator, ListIterator, Enumeration

Interface when accessing to the saved data in collection. Enumeration is old version of Iterator(new). There are no iterator() in Map. => Call keySet(), entrySet(), values(). => Return type is Set and Collection.

Map map = new HashMap();
//map.entrySet() returns Set
//so the iterator can be used!
Iterator it = map.entrySet().iterator();

Last updated