Find highest value in a TreeMap

Hi everybody,I have a treeMap that's sorted alphabetically by keys, but I need to find out which key has the highest value. I can't figure it out, does anyone know how to do it?Thanks!Jezzica85
[223 byte] By [jezzica85a] at [2007-10-3 5:22:09]
# 1
I guess you'll have to iterate through the map (e.g. entrySet) and search for the highest value.
TimTheEnchantora at 2007-7-14 23:29:10 > top of Java-index,Core,Core APIs...
# 2
Go through the map's keyset and check each value. Keep track ofthe highest value you have seen so far and its associated key. Onceyou reach the end of the keyset you will have both the highest value andits key.
pbrockway2a at 2007-7-14 23:29:10 > top of Java-index,Core,Core APIs...
# 3
use comparator to order the treemap based on the value than by key which is natural order.
venkatarajesha at 2007-7-14 23:29:10 > top of Java-index,Core,Core APIs...