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 void
clear()
void
clearCache()
clear value invalided by the timeboolean
containsKey(Object arg0)
boolean
containsValue(Object arg0)
Set<Map.Entry<K,V>>
entrySet()
V
get(Object key)
int
getDefaultTimeValue()
int
getMaxSize()
boolean
isEmpty()
Set<K>
keySet()
void
load(File file)
void
load(InputStream in)
static void
main(String[] args)
V
put(K key, V value)
V
put(K key, V value, int liveTime)
void
putAll(Map<? extends K,? extends V> m)
V
remove(Object key)
void
setDefaultLiveTimeValue(int defaultTimeValue)
set the default time of the attribute live of in secondvoid
setMaxSize(int maxSize)
int
size()
void
store(File file)
void
store(OutputStream out)
V
update(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:
containsKey
in interfaceMap<K,V>
-
containsValue
public boolean containsValue(Object arg0)
- Specified by:
containsValue
in 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
-
-