Vaibhav G Garg wrote:I have a Map of Language Code (as Key) and Lanuage (as Value). I have to sort the map based on the values in the map.
This might sound a bit nitpicky, but you don't
sort a Map; it has an intrinsic
order, which is quite different.
Sorting is an action. I can take a "random"
List of items and sort it any way I like, but a Map's order is determined at the time it's created and cannot be changed after that.
So what you actually want to know is how to
order a Map the way you want and, as Joanne said, a custom Comparator (java.util.Comparator) sounds like what you want.
HIH
Winston