This constructor creates a SortedSet object that orders its elements according to their natural order. SortedSet sorted according to the specified Comparator . The first of these standard constructors is the normal way to create an empty SortedSet with an explicit Comparator . The Range-view operations are somewhat analogous to those provided by the List interface , but there is one big difference. Range-views of a sorted set remain valid even if the backing sorted set is modified directly.
Sorted sets provide three range-view operations.
Rather than indices, the endpoints are objects. Like subList the range is half-open , including its low endpoint but excluding the high one. The former returns a view of the initial portion of the backing SortedSet , up to but not including the specified object. In addition to their obvious uses, last allows a workaround for a deficiency in the SortedSet interface. One thing you'd like to do with a SortedSet is to go into the interior of the set and iterate forwards or backwards.