Package net.ontopia.topicmaps.nav2.utils
Class HistoryMap<T>
- All Implemented Interfaces:
Serializable,Cloneable,Map<Integer,T>
INTERNAL: Helper class for storing elements up to a certain amount,
lower most elements will be removed to ensure a fixed size of the
collection.
- Since:
- 1.2.5
- See Also:
-
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> -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor which uses 20 entries as the default history size and does suppress duplicates.HistoryMap(int maxEntries, boolean suppressDuplicates) Constructor which allows to specify number of entries to store and duplicate suppression behaviour. -
Method Summary
Methods inherited from class java.util.HashMap
clear, clone, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, forEach, get, getOrDefault, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, valuesMethods inherited from class java.util.AbstractMap
equals, hashCode, toString
-
Field Details
-
maxEntries
protected int maxEntries -
suppressDuplicates
protected boolean suppressDuplicates
-
-
Constructor Details
-
HistoryMap
public HistoryMap()Default constructor which uses 20 entries as the default history size and does suppress duplicates. -
HistoryMap
public HistoryMap(int maxEntries, boolean suppressDuplicates) Constructor which allows to specify number of entries to store and duplicate suppression behaviour.- Parameters:
maxEntries- Maxium number of entries to store in the history.suppressDuplicates- Should suppress duplicate entries in map.
-
-
Method Details
-
getMaxEntries
public int getMaxEntries() -
doesSuppressDuplicates
public boolean doesSuppressDuplicates() -
add
-
removeEntry
-
getEntry
-
getEntries
-
getEntriesReverse
-