how to get the sum of values stored in a map java ۰ int sum = map.values().stream().mapToInt(Number::intValue).sum();