Java TreeSet class extends AbstractSet and implements NavigableSet. It is very similar to HashSet class, except it stores the element in sorted order.