Correctly return the new count from add().

git-svn-id: https://samskivert.googlecode.com/svn/trunk@2706 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
ray.j.greenwell
2010-01-18 21:56:20 +00:00
parent efad5d31f6
commit 0534e40a60
+2 -2
View File
@@ -52,14 +52,14 @@ public class CountMap<K> extends AbstractMap<K, Integer>
}
/**
* Add the specified amount to the count for the specified key.
* Add the specified amount to the count for the specified key, return the new count.
*/
public int add (K key, int amount)
{
CountEntry<K> entry = _backing.get(key);
if (entry == null) {
_backing.put(key, entry = new CountEntry<K>(key, amount));
return 0;
return amount;
}
return (entry.count += amount);
}