IcedTea-Web
NetX

net.sourceforge.jnlp.util
Class TimedHashMap<K,V>

java.lang.Object
  extended by net.sourceforge.jnlp.util.TimedHashMap<K,V>

public class TimedHashMap<K,V>
extends java.lang.Object

Simple utility class that extends HashMap by adding an expiry to the entries. This map stores entries, and returns them only if the entries were last accessed within time t=10 seconds


Constructor Summary
TimedHashMap()
           
 
Method Summary
 V get(K key)
          Return cached item if it has not already expired.
 V put(K key, V value)
          Store the item in the map and associate a timestamp with it
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TimedHashMap

public TimedHashMap()
Method Detail

put

public V put(K key,
             V value)
Store the item in the map and associate a timestamp with it

Parameters:
key - The key
value - The value to store

get

public V get(K key)
Return cached item if it has not already expired. Before returning, this method also resets the "last accessed" time for this entry, so it is good for another 10 seconds

Parameters:
key - The key

IcedTea-Web
NetX

Submit a bug or feature