gzz.util
Class CachingMap

java.lang.Object
  |
  +--java.util.AbstractMap
        |
        +--gzz.util.CachingMap
All Implemented Interfaces:
java.util.Map

public class CachingMap
extends java.util.AbstractMap

A map that has a maximum number of entries at any given time. The put method has a side effect of possibly removing entries from the map, including the just added entry, to keep the size within the limits. Currently removes elements randomly, will use LRU later.


Constructor Summary
CachingMap(int maxEntries)
           
 
Method Summary
 java.util.Set entrySet()
           
 java.lang.Object put(java.lang.Object key, java.lang.Object value)
           
 
Methods inherited from class java.util.AbstractMap
clear, clone, containsKey, containsValue, equals, get, hashCode, isEmpty, keySet, putAll, remove, size, toString, values
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CachingMap

public CachingMap(int maxEntries)
Method Detail

put

public java.lang.Object put(java.lang.Object key,
                            java.lang.Object value)
Specified by:
put in interface java.util.Map
Overrides:
put in class java.util.AbstractMap

entrySet

public java.util.Set entrySet()
Specified by:
entrySet in interface java.util.Map
Specified by:
entrySet in class java.util.AbstractMap