TreeSet has higher time complexity for operations.
While TreeSet maintains elements in sorted order, it does so at the cost of higher time complexity (O(log n)) for add, remove, and contains operations compared to HashSet, which has average O(1) time complexity. If you don't need sorting, a HashSet is more efficient for operations like checking for duplicates.