TreeSet is an implementation of NavigableSet and, this way this is also a SortedSet and, as a matter of fact, is also a Set. As a SortableSet documentation implies there are two types of the constructors, each having multiple versions though. One requires some Comparator, the other one relies on the natural ordering of the elements.