Class LoggingLRUMap<KEYTYPE,VALUETYPE>
- java.lang.Object
-
- java.util.AbstractMap<K,V>
-
- java.util.HashMap<K,V>
-
- java.util.LinkedHashMap<KEYTYPE,VALUETYPE>
-
- com.helger.commons.collection.impl.CommonsLinkedHashMap<KEYTYPE,VALUETYPE>
-
- com.helger.commons.collection.map.LRUMap<KEYTYPE,VALUETYPE>
-
- com.helger.commons.collection.map.LoggingLRUMap<KEYTYPE,VALUETYPE>
-
- Type Parameters:
KEYTYPE- Map key typeVALUETYPE- Map value type
- All Implemented Interfaces:
ICommonsMap<KEYTYPE,VALUETYPE>,ICommonsOrderedMap<KEYTYPE,VALUETYPE>,ICloneable<ICommonsMap<KEYTYPE,VALUETYPE>>,Serializable,Cloneable,Map<KEYTYPE,VALUETYPE>
@NotThreadSafe @UseDirectEqualsAndHashCode public class LoggingLRUMap<KEYTYPE,VALUETYPE> extends LRUMap<KEYTYPE,VALUETYPE>
A specificLRUMapthat emits a warning once the map is full and the oldest entry gets discarded.- Author:
- Philip Helger
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K extends Object,V extends Object>, AbstractMap.SimpleImmutableEntry<K extends Object,V extends Object>
-
-
Constructor Summary
Constructors Constructor Description LoggingLRUMap(int nMaxSize)LoggingLRUMap(LoggingLRUMap<KEYTYPE,VALUETYPE> rhs)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object o)LoggingLRUMap<KEYTYPE,VALUETYPE>getClone()StringgetMapName()inthashCode()protected voidonRemoveEldestEntry(int nSize, Map.Entry<KEYTYPE,VALUETYPE> aEntry)Protected method that is invoked every time the oldest entry is removed.LoggingLRUMap<KEYTYPE,VALUETYPE>setMapName(String sMapName)StringtoString()-
Methods inherited from class com.helger.commons.collection.map.LRUMap
getMaxSize, removeEldestEntry
-
Methods inherited from class com.helger.commons.collection.impl.CommonsLinkedHashMap
createInstance
-
Methods inherited from class java.util.LinkedHashMap
clear, containsValue, entrySet, forEach, get, getOrDefault, keySet, replaceAll, values
-
Methods inherited from class java.util.HashMap
clone, compute, computeIfAbsent, computeIfPresent, containsKey, isEmpty, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, size
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.helger.commons.collection.impl.ICommonsMap
addAll, containsAnyEntry, containsAnyKey, containsAnyValue, copyOfValues, copyOfValues, copyOfValuesMapped, copyOfValuesMapped, findFirstEntry, findFirstKey, findFirstValue, forEach, forEachKey, forEachKey, forEachValue, forEachValue, getAsUnmodifiable, getFirstEntry, getFirstEntry, getFirstKey, getFirstKey, getFirstValue, getFirstValue, getSortedByKey, getSortedByValue, getSwappedKeyValues, isNotEmpty, put, putAll, putAll, putAllMapped, putAllMapped, putAllMapped, putIf, putIfNotNull, removeAll, removeIf, removeIfKey, removeIfValue, removeObject, setAll
-
Methods inherited from interface com.helger.commons.collection.impl.ICommonsOrderedMap
copyOfEntrySet, copyOfKeySet, copyOfKeySet, getLastKey, getLastKey, getLastValue, getLastValue
-
Methods inherited from interface java.util.Map
clear, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, forEach, get, getOrDefault, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values
-
-
-
-
Constructor Detail
-
LoggingLRUMap
public LoggingLRUMap(@Nonnegative int nMaxSize)
-
LoggingLRUMap
public LoggingLRUMap(@Nonnull LoggingLRUMap<KEYTYPE,VALUETYPE> rhs)
-
-
Method Detail
-
getClone
@Nonnull public LoggingLRUMap<KEYTYPE,VALUETYPE> getClone()
-
setMapName
@Nonnull public final LoggingLRUMap<KEYTYPE,VALUETYPE> setMapName(@Nullable String sMapName)
-
onRemoveEldestEntry
protected void onRemoveEldestEntry(@Nonnegative int nSize, @Nonnull Map.Entry<KEYTYPE,VALUETYPE> aEntry)
Description copied from class:LRUMapProtected method that is invoked every time the oldest entry is removed.- Overrides:
onRemoveEldestEntryin classLRUMap<KEYTYPE,VALUETYPE>- Parameters:
nSize- Current size of the map. Always ≥ 0.aEntry- The map entry that is removed. Nevernull.
-
equals
public boolean equals(Object o)
-
hashCode
public int hashCode()
-
-