info.informatica.util
Class CacheMap<K,V>

java.lang.Object
  extended by java.util.AbstractMap<K,V>
      extended by java.util.HashMap<K,V>
          extended by info.informatica.util.CacheMap<K,V>
All Implemented Interfaces:
Serializable, Cloneable, Map<K,V>

public class CacheMap<K,V>
extends HashMap<K,V>

A HashMap-based cache with an expiration method

Version:
1.01
Author:
amengual at informatica dot info
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>
 
Constructor Summary
CacheMap()
           
CacheMap(int initialCapacity)
           
CacheMap(int initialCapacity, float loadFactor)
           
 
Method Summary
 void clear()
           
 Object clone()
           
 boolean containsKey(Object key)
           
 void expire(int exptime)
           
 V get(Object key)
           
 V put(K key, V value)
           
 V remove(Object key)
           
 
Methods inherited from class java.util.HashMap
containsValue, entrySet, isEmpty, keySet, putAll, size, values
 
Methods inherited from class java.util.AbstractMap
equals, hashCode, toString
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Constructor Detail

CacheMap

public CacheMap()

CacheMap

public CacheMap(int initialCapacity)

CacheMap

public CacheMap(int initialCapacity,
                float loadFactor)
Method Detail

clear

public void clear()
Specified by:
clear in interface Map<K,V>
Overrides:
clear in class HashMap<K,V>

clone

public Object clone()
Overrides:
clone in class HashMap<K,V>

containsKey

public boolean containsKey(Object key)
Specified by:
containsKey in interface Map<K,V>
Overrides:
containsKey in class HashMap<K,V>

get

public V get(Object key)
Specified by:
get in interface Map<K,V>
Overrides:
get in class HashMap<K,V>

put

public V put(K key,
             V value)
Specified by:
put in interface Map<K,V>
Overrides:
put in class HashMap<K,V>

remove

public V remove(Object key)
Specified by:
remove in interface Map<K,V>
Overrides:
remove in class HashMap<K,V>

expire

public void expire(int exptime)