[Java] Reverse ordering a TreeMap
TreeMap is a Map that keep the element in the natural order of the key. The order can be changed providing to the contructor of the TreeMap a Comparable. So you can implement your custom one for more specific tasks. However if you only need a reverse order, you can easily use the beautiful Collections class with his reverseOrder().
Here is a quick example
Map reverseOrderedMap = new TreeMap(Collections.reverseOrder());
Here it is. Easy!

hi… this forum, helped me solving an issue..
it is easy man. thanks a lot
Thanks Buddy!!
It helped.
Thanks Man!!! Very helpful …
Very helpful… Thanks
Just what I was looking for. Much obliged.
Happy to be helpful