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:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user