How does `TreeSet` compare elements to maintain order?
`TreeSet` uses an internal hash function to compare elements and maintain the order.
You're partially correct, but `TreeSet` does not use hashing; it uses a binary search tree structure, typically a Red-Black Tree.
Can you explain how a Red-Black Tree helps maintain the order in a `TreeSet`?