We need to notify all values about removal when we clear the table.

git-svn-id: https://samskivert.googlecode.com/svn/trunk@1686 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
mdb
2005-08-05 02:45:45 +00:00
parent 5f02c3fe6e
commit 809df481c1
@@ -254,6 +254,15 @@ public class LRUHashMap implements Map
// documentation inherited from interface
public void clear ()
{
// notify all values of their removal
for (Iterator iter = _delegate.values().iterator(); iter.hasNext(); ) {
Object value = iter.next();
if (value instanceof LRUItem) {
((LRUItem)value).removedFromMap(this);
}
}
// then clear everything out
_delegate.clear();
_size = 0;
}