From 0534e40a602f4b0b74704cce4e82bdab9abf73a6 Mon Sep 17 00:00:00 2001 From: "ray.j.greenwell" Date: Mon, 18 Jan 2010 21:56:20 +0000 Subject: [PATCH] Correctly return the new count from add(). git-svn-id: https://samskivert.googlecode.com/svn/trunk@2706 6335cc39-0255-0410-8fd6-9bcaacd3b74c --- src/java/com/samskivert/util/CountMap.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/java/com/samskivert/util/CountMap.java b/src/java/com/samskivert/util/CountMap.java index 6ba351ed..07c70489 100644 --- a/src/java/com/samskivert/util/CountMap.java +++ b/src/java/com/samskivert/util/CountMap.java @@ -52,14 +52,14 @@ public class CountMap extends AbstractMap } /** - * 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 entry = _backing.get(key); if (entry == null) { _backing.put(key, entry = new CountEntry(key, amount)); - return 0; + return amount; } return (entry.count += amount); }