I want to output the lowest value from a HashMap
. So far, I can iterate through the HashMap
and print out it's values, but I'm not sure how to compare the values in the map itself and print out the key and value for the smallest one. This is how I am iterating:
for (HashMap.Entry<String, Integer> entry : itemTime.entrySet()) {
System.out.println(entry.getKey() + " " + entry.getValue());
}