You can get all the values from a Map, put them in a List, and sort them using Collections.sort(). However this has no effect on the original Map Using a TreeMap won't help much either, as a TreeMap wants to sort by
key, not value. You could solve this problem using
two maps, where the second maps in reverse order (reversing key and value). Or you could use a
TreeBidimap from
Jakarta Commons Collections. That last is probably easiest.