Have the increment method return the new value.

git-svn-id: https://samskivert.googlecode.com/svn/trunk@1805 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
andrzej
2006-03-31 23:46:44 +00:00
parent 046c9c29b9
commit f5199e0baf
+5 -2
View File
@@ -115,14 +115,17 @@ public class IntIntMap
* Increments the value associated with the specified key by the
* specified amount. If the key has no previously assigned value, it
* will be set to the amount specified (as if incrementing from zero).
*
* @return the incremented value now stored for the key
*/
public void increment (int key, int amount)
public int increment (int key, int amount)
{
Record rec = locateRecord(key);
if (rec == null) {
put(key, amount);
return amount;
} else {
rec.value += amount;
return (rec.value += amount);
}
}