Create a new key/value pair or change the value of one. @webref intdict:method @webBrief Create a new key/value pair or change the value of one
(String key, int amount)
| 387 | * @webBrief Create a new key/value pair or change the value of one |
| 388 | */ |
| 389 | public void set(String key, int amount) { |
| 390 | int index = index(key); |
| 391 | if (index == -1) { |
| 392 | create(key, amount); |
| 393 | } else { |
| 394 | values[index] = amount; |
| 395 | } |
| 396 | } |
| 397 | |
| 398 | |
| 399 | public void setIndex(int index, String key, int value) { |