Package ghidra.util.datastruct
Class LRUMap<K,V>
- java.lang.Object
- 
- ghidra.util.datastruct.LRUMap<K,V>
 
- 
- Type Parameters:
- K- the key type
- V- the value type
 - All Implemented Interfaces:
- java.util.Map<K,V>
 - Direct Known Subclasses:
- LRUSet
 
 public class LRUMap<K,V> extends java.lang.Object implements java.util.Map<K,V>A LRU (Least Recently Used) map that maintains access-order (newest to oldest) iteration over the elements. This map is limited to the given size. As new items are added, the older items will be removed from this map.If you need to be notified of removals, then you can override eldestEntryRemoved(java.util.Map.Entry).If you don't want the eldest removed, override removeEldestEntry(java.util.Map.Entry)and return false;If you would like to have the iteration order of your LRU structure be based upon access, but want it to iterate from least recently used to most recently used, then you should see FixedSizeHashMap.- See Also:
- LinkedHashMap,- FixedSizeHashMap
 
- 
- 
Constructor SummaryConstructors Constructor Description LRUMap(int cacheSize)
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()booleancontainsKey(java.lang.Object key)booleancontainsValue(java.lang.Object value)protected voideldestEntryRemoved(java.util.Map.Entry<K,V> eldest)This is called after an item has been removed from the cache.java.util.Set<java.util.Map.Entry<K,V>>entrySet()Vget(java.lang.Object key)booleanisEmpty()java.util.Set<K>keySet()Vput(K key, V value)voidputAll(java.util.Map<? extends K,? extends V> m)Vremove(java.lang.Object key)protected booleanremoveEldestEntry(java.util.Map.Entry<K,V> eldest)intsize()java.lang.StringtoString()java.util.Collection<V>values()
 
- 
- 
- 
Method Detail- 
containsKeypublic boolean containsKey(java.lang.Object key) 
 - 
containsValuepublic boolean containsValue(java.lang.Object value) 
 - 
valuespublic java.util.Collection<V> values() 
 - 
eldestEntryRemovedprotected void eldestEntryRemoved(java.util.Map.Entry<K,V> eldest) This is called after an item has been removed from the cache.- Parameters:
- eldest- the item being removed
 
 - 
toStringpublic java.lang.String toString() - Overrides:
- toStringin class- java.lang.Object
 
 
- 
 
-