TreeSet descendingIterator method

TreeSet descendingIterator method returns an iterator with the elements sorted in a descending order.

When inserting any element into TreeSet it automatically gets sorted into its natural sorting order.
TreeSet descendingIterator method is useful when you need a sorted list in descending order but do not want to write a comparator.

TreeSet descendingIterator method example

Output

TreeSet descendingIterator method

References

1. TreeSet descendingIterator method java docs

It's only fair to share...Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn