Commit 5ab198b6 by Patryk Czarnik

kalk 1-metodowy 1

parent 2aa2c84e
...@@ -14,10 +14,8 @@ public class P3_Grupowanie { ...@@ -14,10 +14,8 @@ public class P3_Grupowanie {
for (Employee emp : emps) { for (Employee emp : emps) {
final String city = emp.getCity(); final String city = emp.getCity();
if (cnt.containsKey(city)) { if (cnt.containsKey(city)) {
Integer oldCnt = cnt.get(city); cnt.put(city, cnt.get(city) +1);
cnt.put(city, oldCnt+1); sum.put(city, sum.get(city) +emp.getSalary());
Integer oldSum = sum.get(city);
sum.put(city, oldSum+emp.getSalary());
} else { } else {
cnt.put(city, 1); cnt.put(city, 1);
sum.put(city, emp.getSalary()); sum.put(city, emp.getSalary());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment