Similar to how we found the maximum value in a map this example will show the opposite and find the minimum. To accomplish this we will compare each value finding the minimum value. In the setUp method mapValues will be initialized and populated to be used in each snippet below.
Setup
Straight up Java
Until java 8 there isn't a great way found in the API using straight up java. Iterating over a hashmap and comparing each value and if it less than the prior it will be set to the minEntry temporary value.
Java 8
Transforming a hashmap to stream while passing the same comparator used to sort a map to the min method will return an java 8 Optional of type Entry. Getting the value should return an Integer with the value of 1.