Package org.javlo.utils
Class TimeMap<K,V>
- java.lang.Object
-
- org.javlo.utils.TimeMap<K,V>
-
-
Constructor Summary
Constructors Constructor Description TimeMap()TimeMap(int inDefaultTimeLiveValueSecond)set the default time of the attribute live in secondTimeMap(int inDefaultTimeLiveValueSecond, int maxSize)TimeMap(Map<K,V> internalMap)TimeMap(Map<K,V> internalMap, int inDefaultTimeLiveValueSecond)TimeMap(Map<K,V> internalMap, int inDefaultTimeLiveValueSecond, int maxSize)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()voidclearCache()clear value invalided by the timebooleancontainsKey(Object arg0)booleancontainsValue(Object arg0)Set<Map.Entry<K,V>>entrySet()Vget(Object key)intgetDefaultTimeValue()intgetMaxSize()booleanisEmpty()Set<K>keySet()voidload(File file)voidload(InputStream in)static voidmain(String[] args)Vput(K key, V value)Vput(K key, V value, int liveTime)voidputAll(Map<? extends K,? extends V> m)Vremove(Object key)voidsetDefaultLiveTimeValue(int defaultTimeValue)set the default time of the attribute live of in secondvoidsetMaxSize(int maxSize)intsize()voidstore(File file)voidstore(OutputStream out)Vupdate(K key, V value)update value, without reset timeCollection<V>values()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, equals, forEach, getOrDefault, hashCode, merge, putIfAbsent, remove, replace, replace, replaceAll
-
-
-
-
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-
-
containsKey
public boolean containsKey(Object arg0)
- Specified by:
containsKeyin interfaceMap<K,V>
-
containsValue
public boolean containsValue(Object arg0)
- Specified by:
containsValuein interfaceMap<K,V>
-
update
public V update(K key, V value)
update value, without reset time- Parameters:
key-value-- Returns:
- previousValue
-
clearCache
public void clearCache()
clear value invalided by the time
-
getMaxSize
public int getMaxSize()
-
setMaxSize
public void setMaxSize(int maxSize)
-
store
public void store(OutputStream out) throws Exception
- Throws:
Exception
-
load
public void load(InputStream in) throws IOException
- Throws:
IOException
-
-