HashMap<String, Integer> map = new HashMap<String, Integer>();
Iterator iter = map.entrySet().iterator();
int num = 1;
HashMap<String, Integer> tempMap = new HashMap<String, Integer>(1);String tempKey = null;
while (iter.hasNext()) {
Map.Entry entry = (Map.Entry) iter.next();
String key = (String) entry.getKey();
int val = (Integer) entry.getValue();
if(val<100)
{
if(tempMap != null && tempKey != null){
if(val < tempMap.get(tempKey)) {
tempKey = key;
tempMap.put(key, val);
}
}
if(tempKey == null){
tempKey = key;
tempMap.put(key, val);
}
num = Math.max(val, num);
}
}
最大的value为num,对应的key为tempKey