Package jadex.commons.collection
Class LRU<K,V>
- java.lang.Object
- 
- java.util.AbstractMap<K,V>
- 
- java.util.HashMap<K,V>
- 
- java.util.LinkedHashMap<K,V>
- 
- jadex.commons.collection.LRU<K,V>
 
 
 
 
- 
- All Implemented Interfaces:
- java.io.Serializable,- java.lang.Cloneable,- java.util.Map<K,V>
 
 public class LRU<K,V> extends java.util.LinkedHashMap<K,V>A least recently used map.- See Also:
- Serialized Form
 
- 
- 
Field SummaryFields Modifier and Type Field Description protected ILRUEntryCleanercleanerThe entry cleaner (for performing cleanup code on removed entries).protected intmaxThe maximum number of entries.
 - 
Constructor SummaryConstructors Constructor Description LRU()Create a new LRU with 1000 entries.LRU(int max)Create a new LRU.LRU(int max, ILRUEntryCleaner cleaner)Create a new LRU.LRU(int max, ILRUEntryCleaner cleaner, boolean accessorder)Create a new LRU.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description ILRUEntryCleanergetCleaner()Get the cleaner object.intgetMaxEntries()Get the maximum number of theVput(K key, V value)booleanremoveEldestEntry(java.util.Map.Entry<K,V> eldest)Remove the eldest entry.voidsetCleaner(ILRUEntryCleaner cleaner)Set the cleaner object.voidsetMaxEntries(int max)Set the maximum number of entries.- 
Methods inherited from class java.util.LinkedHashMapclear, containsValue, entrySet, forEach, get, getOrDefault, keySet, replaceAll, values
 - 
Methods inherited from class java.util.HashMapclone, compute, computeIfAbsent, computeIfPresent, containsKey, isEmpty, merge, putAll, putIfAbsent, remove, remove, replace, replace, size
 
- 
 
- 
- 
- 
Field Detail- 
maxprotected int max The maximum number of entries.
 - 
cleanerprotected ILRUEntryCleaner cleaner The entry cleaner (for performing cleanup code on removed entries).
 
- 
 - 
Constructor Detail- 
LRUpublic LRU() Create a new LRU with 1000 entries.
 - 
LRUpublic LRU(int max) Create a new LRU.- Parameters:
- max- The maximum number of entries.
 
 - 
LRUpublic LRU(int max, ILRUEntryCleaner cleaner)Create a new LRU.- Parameters:
- max- The maximum number of entries.
 
 - 
LRUpublic LRU(int max, ILRUEntryCleaner cleaner, boolean accessorder)Create a new LRU.- Parameters:
- max- The maximum number of entries.
- cleaner- Optional cleaner.
- accessorder- If true, entry use is refreshed on read as well as write.
 
 
- 
 - 
Method Detail- 
getMaxEntriespublic int getMaxEntries() Get the maximum number of the- Returns:
- The maximum number of entries.
 
 - 
setMaxEntriespublic void setMaxEntries(int max) Set the maximum number of entries.- Parameters:
- max- The maximum number of entries.
 
 - 
getCleanerpublic ILRUEntryCleaner getCleaner() Get the cleaner object.- Returns:
- The cleaner object.
 
 - 
setCleanerpublic void setCleaner(ILRUEntryCleaner cleaner) Set the cleaner object.- Parameters:
- cleaner- The cleaner object.
 
 
- 
 
-