- It is the child interface of set.
- If we want to represent a group of individual object according to some sorting order and duplicates are not allow then we should go for SortedSet.
Methods specified in SortedSet
Basically, there are 6 methods available in SortedSet which are as follows:
- first(): it retrieves the first object from a given set of objects.
retrieves the last object;
- headset(Object o)
retrieves one or more than one objects which are less than the specified object.
- tailset(Object o)
Retrieves one more than one objects which are greater than or equal to specified objects.
- subset(Object o1,objecto2)
Retrieves one or more than one objects which are greater than or equal to Object o1 but less than Objecto2.
- comparator() :
returns comparator objects which describe underlying sorting technique.