Lecture 13
4
• Set keys = map.keySet();
• Iterator keysIterator =       keys.iterator();  
•ask the map for its keySet
•ask the keySet to give you an Iterator
•keysIterator is like a list of the keys in the map
•You can infer from this code that
–Set and Iterator are classes in the Java API
–keySet is a method in class TreeMap; it returns a Set
–iterator is a method in class Set; it returns an Iterator
Getting an Iterator