previous |
start |
next
TreeSet and HashSet
- 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
previous |
start |
next