-1

Can TreeSet be sorted in opposite way when objects are already in the set?

I mean, I inserted 10^6 words in a TreeSet and I want to sort it now the opposite way. To my knowledge this is not possible, but I need to ask.

  • possible duplicate of [Treeset to order elements in descending order](http://stackoverflow.com/questions/1090969/treeset-to-order-elements-in-descending-order) – assylias May 08 '14 at 07:26

1 Answers1

2

You can use TreeSet.descendingSet() to return a reverse view of it. You should always read the javadocs (and then Google) before asking a question here or anywhere else.

Kayaman
  • 72,141
  • 5
  • 83
  • 121