From f5199e0baf5fa222e960b95b09f84e8d143d9b61 Mon Sep 17 00:00:00 2001 From: andrzej Date: Fri, 31 Mar 2006 23:46:44 +0000 Subject: [PATCH] Have the increment method return the new value. git-svn-id: https://samskivert.googlecode.com/svn/trunk@1805 6335cc39-0255-0410-8fd6-9bcaacd3b74c --- src/java/com/samskivert/util/IntIntMap.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/java/com/samskivert/util/IntIntMap.java b/src/java/com/samskivert/util/IntIntMap.java index 542cc7bf..0af0d82b 100644 --- a/src/java/com/samskivert/util/IntIntMap.java +++ b/src/java/com/samskivert/util/IntIntMap.java @@ -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); } }