Пример #1
1
 public void grantAmmo(String aw) {
   if (!ammo.containsKey(aw)) ammo.put(aw, 0);
   ammo.compute(aw, (k, v) -> (++v));
 }
Пример #2
0
 public void deductAmmo(String aw) {
   if (ammo.containsKey(aw)) ammo.compute(aw, (k, v) -> (--v));
 }