KEYTYPE - Key typeVALUETYPE - Value type@NotThreadSafe @UseDirectEqualsAndHashCode public class LRUMap<KEYTYPE,VALUETYPE> extends LinkedHashMap<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() |
clear, containsValue, getclone, containsKey, entrySet, isEmpty, keySet, put, putAll, remove, 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–2015 Philip Helger. All rights reserved.