Class TimeMap<K,​V>

  • Type Parameters:
    K -
    V -
    All Implemented Interfaces:
    Map<K,​V>

    public class TimeMap<K,​V>
    extends Object
    implements Map<K,​V>
    map with item stay a specified time inside.
    Author:
    Patrick Vandermaesen
    • Constructor Detail

      • TimeMap

        public TimeMap()
      • TimeMap

        public TimeMap​(int inDefaultTimeLiveValueSecond)
        set the default time of the attribute live in second
      • TimeMap

        public TimeMap​(int inDefaultTimeLiveValueSecond,
                       int maxSize)
      • TimeMap

        public TimeMap​(Map<K,​V> internalMap)
      • TimeMap

        public TimeMap​(Map<K,​V> internalMap,
                       int inDefaultTimeLiveValueSecond)
      • TimeMap

        public TimeMap​(Map<K,​V> internalMap,
                       int inDefaultTimeLiveValueSecond,
                       int maxSize)
    • Method Detail

      • getDefaultTimeValue

        public int getDefaultTimeValue()
      • setDefaultLiveTimeValue

        public void setDefaultLiveTimeValue​(int defaultTimeValue)
        set the default time of the attribute live of in second
        Parameters:
        defaultTimeValue -
      • clear

        public void clear()
        Specified by:
        clear in interface Map<K,​V>
      • containsKey

        public boolean containsKey​(Object arg0)
        Specified by:
        containsKey in interface Map<K,​V>
      • get

        public V get​(Object key)
        Specified by:
        get in interface Map<K,​V>
      • isEmpty

        public boolean isEmpty()
        Specified by:
        isEmpty in interface Map<K,​V>
      • keySet

        public Set<K> keySet()
        Specified by:
        keySet in interface Map<K,​V>
      • put

        public V put​(K key,
                     V value)
        Specified by:
        put in interface Map<K,​V>
      • put

        public V put​(K key,
                     V value,
                     int liveTime)
      • update

        public V update​(K key,
                        V value)
        update value, without reset time
        Parameters:
        key -
        value -
        Returns:
        previousValue
      • putAll

        public void putAll​(Map<? extends K,​? extends V> m)
        Specified by:
        putAll in interface Map<K,​V>
      • remove

        public V remove​(Object key)
        Specified by:
        remove in interface Map<K,​V>
      • size

        public int size()
        Specified by:
        size in interface Map<K,​V>
      • clearCache

        public void clearCache()
        clear value invalided by the time
      • getMaxSize

        public int getMaxSize()
      • setMaxSize

        public void setMaxSize​(int maxSize)