title: Using tree map for sorting in descending order by values
body: <p>I just have a map implementation below to sort the values in descending order and I have used the below implementation.</p>
  
  <pre><code>public static Map&lt;String,Integer&gt; sortByComparator(Map&lt;String,Integer&gt; unsortMap) {
  
      List list = new LinkedList(unsortMap.entrySet());
  
      //sort list based on comparator
      Collections.sort(list, new Comparator() {
          public int compare(Object o1, Object o2) {
              return ((Comparable) ((Map.Entry) (o2)).getValue())
                      .compareTo(((Map.Entry) (o1)).getValue());
          }
      });
  
      //put sorted list into map again
      Map sortedMap = new LinkedHashMap();
      for (Iterator it = list.iterator(); it.hasNext();) {
          Map.Entry entry = (Map.Entry)it.next();
          sortedMap.put(entry.getKey(), entry.getValue());
      }
      return sortedMap;
  }   
  </code></pre>
  
  <p>This does the necessary functions.. But I am curious to know whether I will be able to use tree map to sort this by descending order </p>