How to sum hashmap like in my first comment | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to sum hashmap like in my first comment

29th Apr 2017, 12:51 PM
Ken Ben
Ken Ben - avatar
2 Answers
+ 4
int sum = 0; for (int a : map.values()) { sum=sum+a; } System.out.println(sum);
29th Apr 2017, 1:02 PM
Manideep
Manideep - avatar
0
map.put("A",3); map.put("A",3); map.put("A",3); if i input A then input B total : 6 how to code like this
29th Apr 2017, 12:53 PM
Ken Ben
Ken Ben - avatar