Using Tree Sets and Tree Maps
- HashSet and TreeSet both implement the Set interface
- With a good hash function, hashing is generally faster than tree-based algorithms
- TreeSet's balanced tree guarantees reasonable performance
- TreeSet's iterator visits the elements in sorted order rather than the HashSet's
random order