public class HistoryMap<T> extends HashMap<Integer,T>
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>
Modifier and Type | Field and Description |
---|---|
protected int |
maxEntries |
protected boolean |
suppressDuplicates |
Constructor and Description |
---|
HistoryMap()
Default 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.
|
Modifier and Type | Method and Description |
---|---|
void |
add(T obj) |
boolean |
doesSuppressDuplicates() |
Collection<T> |
getEntries() |
Collection |
getEntriesReverse() |
T |
getEntry(int index) |
int |
getMaxEntries() |
void |
removeEntry(T obj) |
clear, clone, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, forEach, get, getOrDefault, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values
equals, hashCode, toString
protected int maxEntries
protected boolean suppressDuplicates
public HistoryMap()
public HistoryMap(int maxEntries, boolean suppressDuplicates)
maxEntries
- Maxium number of entries to store in the history.suppressDuplicates
- Should suppress duplicate entries in map.public int getMaxEntries()
public boolean doesSuppressDuplicates()
public void add(T obj)
public void removeEntry(T obj)
public T getEntry(int index)
public Collection<T> getEntries()
public Collection getEntriesReverse()