Advanced Java Tutorial

Total available pages count: 55
Subject - Java Technologies

SortedSet interface

The SortedSet is an alternative to the set interface which provides a total ordering on its element. The element of SortedSet is organized in increasing or ascending order. The SortedSet provide methods that inhibit natural ordering of element.


SortedSet<data-type> set = new TreeSet();



TreeSet implements the set interface which uses 'tree' for storage. It contains unique elements like HashSet. It doesn’t have a null element