sum values from hashmap code example
Example 1: how to sum the values of a hashmap
float sum = 0.0f;
for (float f : map.values()) {
sum += f;
}
Example 2: hashmap values sum java
Map<Object,ArrayList<Object>> multiMap = new HashMap<>();
float sum = 0.0f;
for (float f : map.values()) {
sum += f;
}
Map<Object,ArrayList<Object>> multiMap = new HashMap<>();