Class SoftLinkedHashMap<K,V>
- java.lang.Object
-
- java.util.AbstractMap<K,V>
-
- com.helger.commons.collection.map.AbstractSoftMap<K,V>
-
- com.helger.commons.collection.map.SoftLinkedHashMap<K,V>
-
- Type Parameters:
K- Key typeV- Value type
- All Implemented Interfaces:
ICommonsMap<K,V>,ICloneable<ICommonsMap<K,V>>,Map<K,V>
public class SoftLinkedHashMap<K,V> extends AbstractSoftMap<K,V>
SoftHashMapimplementation based on http://www.javaspecialists.eu/archive/Issue015.html
TheentrySetimplementation is fromorg.hypergraphdb.util
Note:SoftLinkedHashMapis NOT serializable!- Author:
- Philip Helger
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.helger.commons.collection.map.AbstractSoftMap
AbstractSoftMap.SoftValue<K,V>
-
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>
-
-
Field Summary
-
Fields inherited from class com.helger.commons.collection.map.AbstractSoftMap
m_aSrcMap
-
-
Constructor Summary
Constructors Constructor Description SoftLinkedHashMap(int nMaxSize)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object o)SoftLinkedHashMap<K,V>getClone()intgetMaxSize()inthashCode()protected voidonRemoveEldestEntry(int nSize, Map.Entry<K,V> aEldest)Protected method that is invoked every time the oldest entry is removed.-
Methods inherited from class com.helger.commons.collection.map.AbstractSoftMap
clear, entrySet, get, onEntryRemoved, put, remove, size
-
Methods inherited from class java.util.AbstractMap
clone, containsKey, containsValue, isEmpty, keySet, putAll, toString, values
-
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, copyOfEntrySet, copyOfKeySet, copyOfKeySet, copyOfValues, copyOfValues, copyOfValuesMapped, copyOfValuesMapped, createInstance, 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 java.util.Map
compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, forEach, getOrDefault, isEmpty, keySet, merge, putAll, putIfAbsent, remove, replace, replace, replaceAll, values
-
-
-
-
Constructor Detail
-
SoftLinkedHashMap
public SoftLinkedHashMap(@Nonnegative int nMaxSize)
-
-
Method Detail
-
getMaxSize
@Nonnegative public final int getMaxSize()
- Returns:
- The maximum number of elements that can reside inside this object. Never < 0.
-
onRemoveEldestEntry
@OverrideOnDemand protected void onRemoveEldestEntry(@Nonnegative int nSize, @Nonnull Map.Entry<K,V> aEldest)
Protected method that is invoked every time the oldest entry is removed.- Parameters:
nSize- Current size of the map. Always ≥ 0.aEldest- The map entry that is removed. Nevernull.
-
getClone
@Nonnull @ReturnsMutableCopy public SoftLinkedHashMap<K,V> getClone()
- Returns:
- A 100% deep-copy of the implementing class.
-
equals
public boolean equals(Object o)
-
-