bitronix.tm.utils
Class LruMap

java.lang.Object
  extended by java.util.AbstractMap<K,V>
      extended by java.util.HashMap
          extended by bitronix.tm.utils.LruMap
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.util.Map

public class LruMap
extends java.util.HashMap

Last Recently Used Map with eviction listeners support implementation.

© Bitronix Software

Author:
lorban
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.util.AbstractMap
java.util.AbstractMap.SimpleEntry<K,V>, java.util.AbstractMap.SimpleImmutableEntry<K,V>
 
Constructor Summary
LruMap(int maxSize)
           
 
Method Summary
 void addEvictionListener(LruEvictionListener listener)
           
 void clear()
           
 java.lang.Object get(java.lang.Object key)
           
 java.lang.Object put(java.lang.Object key, java.lang.Object value)
           
 java.lang.Object remove(java.lang.Object key)
           
 void removeEvictionListener(LruEvictionListener listener)
           
 
Methods inherited from class java.util.HashMap
clone, containsKey, containsValue, entrySet, isEmpty, keySet, putAll, size, values
 
Methods inherited from class java.util.AbstractMap
equals, hashCode, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Constructor Detail

LruMap

public LruMap(int maxSize)
Method Detail

put

public java.lang.Object put(java.lang.Object key,
                            java.lang.Object value)
Specified by:
put in interface java.util.Map
Overrides:
put in class java.util.HashMap

get

public java.lang.Object get(java.lang.Object key)
Specified by:
get in interface java.util.Map
Overrides:
get in class java.util.HashMap

remove

public java.lang.Object remove(java.lang.Object key)
Specified by:
remove in interface java.util.Map
Overrides:
remove in class java.util.HashMap

clear

public void clear()
Specified by:
clear in interface java.util.Map
Overrides:
clear in class java.util.HashMap

addEvictionListener

public void addEvictionListener(LruEvictionListener listener)

removeEvictionListener

public void removeEvictionListener(LruEvictionListener listener)