From e45cd42c3105774049ed8a9d5aac9d1369379818 Mon Sep 17 00:00:00 2001 From: andrzej Date: Thu, 30 Aug 2007 21:52:34 +0000 Subject: [PATCH] Added Charlie's adjustSize method. git-svn-id: https://samskivert.googlecode.com/svn/trunk@2220 6335cc39-0255-0410-8fd6-9bcaacd3b74c --- src/java/com/samskivert/util/LRUHashMap.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/java/com/samskivert/util/LRUHashMap.java b/src/java/com/samskivert/util/LRUHashMap.java index be14da3d..33bae6ce 100644 --- a/src/java/com/samskivert/util/LRUHashMap.java +++ b/src/java/com/samskivert/util/LRUHashMap.java @@ -3,7 +3,7 @@ // // samskivert library - useful routines for java programs // Copyright (C) 2001-2007 Michael Bayne -// +// // This library is free software; you can redistribute it and/or modify it // under the terms of the GNU Lesser General Public License as published // by the Free Software Foundation; either version 2.1 of the License, or @@ -164,6 +164,17 @@ public class LRUHashMap implements Map return _delegate.size(); } + /** + * Update the overall size of the cache if an already added item changes size. + * + * @param sizeDifference the amount to adjust the size by. + */ + public void adjustSize (int sizeDifference) + { + _size += sizeDifference; + flush(); + } + // documentation inherited from interface public boolean isEmpty () {