TreeMap default implementation can only sort by key, or when defining treeMap, new Comparator, custom key sorting method, but cannot be sorted by value.
You can use the following method to sort the value once.
Map<String,Integer> map = new TreeMap<String,Integer>();
List<<String,Integer>> list = new ArrayList<<String,Integer>>(());
(list, new Comparator<<String, Integer>>() {
@Override
public int compare(<String, Integer> o1, <String, Integer> o2) {
return () - ();
}
});