Iterating the Elements of a Collection // For sets and lists for (Iterator it=collection.iterator(); it.hasNext(); ) { process(it.next()); } // For keys of a map for (Iterator it=map.keySet().iterator(); it.hasNext(); ) { process(it.next()); } // For values of a map for (Iterator it=map.values().iterator(); it.hasNext(); ) { process(it.next()); }