private class KeyIterator implements Iterator
1: public Iterator<K> getKeyIterator()
2: {
3: return new KeyIterator();
4: } // end getKeyIterator
5: private class KeyIterator implements Iterator<K>
6: {
7: Iterator<Entry<K, V>> localIterator;
8:
9: public KeyIterator()
10: {
11: localIterator = bst.getInorderIterator();
12: } // end default constructor
13:
14: public boolean hasNext()
15: {
16: return localIterator.hasNext();
17: } // end hasNext
18:
19: public K next()
20: {
21: Entry<K, V> nextEntry = localIterator.next();
22: return nextEntry.getKey();
23: } // end next
24:
25: public void remove()
26: {
27: throw new UnsupportedOperationException();
28: } // end remove
29: } // end KeyIterator
30: // Version 4.0