Class HistoryMap<T>

java.lang.Object
java.util.AbstractMap<K,V>
java.util.HashMap<Integer,T>
net.ontopia.topicmaps.nav2.utils.HistoryMap<T>
All Implemented Interfaces:
Serializable, Cloneable, Map<Integer,T>

public class HistoryMap<T> extends HashMap<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:
  • 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

      public void add(T obj)
    • removeEntry

      public void removeEntry(T obj)
    • getEntry

      public T getEntry(int index)
    • getEntries

      public Collection<T> getEntries()
    • getEntriesReverse

      public Collection getEntriesReverse()