Lecture 12
17
• Set allWords = entries.keySet();
• Iterator wordIterator =       allWords.iterator();  
•ask the entries field (a TreeMap) for its keySet
•ask the keySet to give you an Iterator
•wI is like a list of the keys in the entries 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