Java tutorial
//package com.java2s; //License from project: Open Source License import java.util.Iterator; import java.util.Map; import java.util.Set; public class Main { public static String getKeyWithMaxValue(final Map<String, Double> pMap) { final Set<String> tempSet = pMap.keySet(); final Iterator<String> iter = tempSet.iterator(); double max = Integer.MIN_VALUE; String maxValsKey = ""; String temp = ""; while (iter.hasNext()) { temp = iter.next(); if (pMap.get(temp) > max) { max = pMap.get(temp); maxValsKey = temp; } } return maxValsKey + "\t" + max; } }