I frequently use maps to store pairs of data. A large percent of the time I use it to store a mapping between a value and how many times it occurred. What I would like to do in one particular scenario is to provide the output sorted by the value (in this case, the long) rather than the key (in this case, a string). Is there a built-in way to do this or do I need to iterate through the map and check whether my current value is the highest, etc.?