KEYTYPE - Key typeVALUETYPE - Value type@NotThreadSafe @UseDirectEqualsAndHashCode public class LRUMap<KEYTYPE,VALUETYPE> extends CommonsLinkedHashMap<KEYTYPE,VALUETYPE>
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>| Constructor and Description |
|---|
LRUMap(int nMaxSize)
Create a new object with the specified max size.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object o) |
int |
getMaxSize() |
int |
hashCode() |
protected void |
onRemoveEldestEntry(int nSize,
Map.Entry<KEYTYPE,VALUETYPE> aEldest)
Protected method that is invoked every time the oldest entry is removed.
|
protected boolean |
removeEldestEntry(Map.Entry<KEYTYPE,VALUETYPE> aEldest) |
String |
toString() |
getCloneclear, containsValue, entrySet, forEach, get, getOrDefault, keySet, replaceAll, valuesclone, compute, computeIfAbsent, computeIfPresent, containsKey, isEmpty, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, sizefinalize, getClass, notify, notifyAll, wait, wait, waitcopyOfEntrySet, copyOfKeySet, getLastKey, getLastValueaddAll, copyOfValues, copyOfValues, copyOfValuesMapped, copyOfValuesMapped, findFirstEntry, findFirstKey, findFirstValue, getAsUnmodifiable, getFirstEntry, getFirstKey, getFirstValue, getSortedByKey, getSortedByValue, getSwappedKeyValues, isNotEmpty, putIf, putIfNotNull, removeAll, setAllclear, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, forEach, get, getOrDefault, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, valuespublic LRUMap(@Nonnegative int nMaxSize)
nMaxSize - The maximum number of elements in this cache. May not be < 0.@Nonnegative public final int getMaxSize()
@OverrideOnDemand protected void onRemoveEldestEntry(@Nonnegative int nSize, @Nonnull Map.Entry<KEYTYPE,VALUETYPE> aEldest)
nSize - Current size of the map. Always ≥ 0.aEldest - The map entry that is removed. Never null.protected final boolean removeEldestEntry(@Nonnull Map.Entry<KEYTYPE,VALUETYPE> aEldest)
removeEldestEntry in class LinkedHashMap<KEYTYPE,VALUETYPE>public boolean equals(Object o)
public int hashCode()
public String toString()
toString in class AbstractMap<KEYTYPE,VALUETYPE>Copyright © 2014–2016 Philip Helger. All rights reserved.