0

How to sum values in java map

29th Apr 2017, 12:24 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, 12:37 PM
Manideep
Manideep - avatar
0
map.put("A",3); map.put("B",3); map.put("C",3); if i input A input B total : 6 pls how
29th Apr 2017, 12:26 PM
Ken Ben
Ken Ben - avatar