edu.mit.ai.psg.utilities
Class HashMapCache

java.lang.Object
  |
  +--java.util.AbstractMap
        |
        +--java.util.WeakHashMap
              |
              +--edu.mit.ai.psg.utilities.HashMapCache

public class HashMapCache
extends WeakHashMap

HashMapCache is a Map which keeps references to values as java.lang.ref.SoftReferences, and removes entries after values are garbage collected. Since it is a WeakHashMap, entries are also removed after keys are garbage collected. Supports null keys and null values.


Inner Class Summary
protected static class HashMapCache.Entry
           
protected  class HashMapCache.EntrySet
           
 
Constructor Summary
HashMapCache()
           
HashMapCache(int initialCapacity)
           
HashMapCache(int initialCapacity, float loadFactor)
           
 
Method Summary
 Set entrySet()
           
 Object get(Object key)
           
 Object put(Object key, Object value)
           
 
Methods inherited from class java.util.WeakHashMap
clear, containsKey, isEmpty, remove, size
 
Methods inherited from class java.util.AbstractMap
containsValue, equals, hashCode, keySet, putAll, toString, values
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

HashMapCache

public HashMapCache()

HashMapCache

public HashMapCache(int initialCapacity)

HashMapCache

public HashMapCache(int initialCapacity,
                    float loadFactor)
Method Detail

put

public Object put(Object key,
                  Object value)
Overrides:
put in class WeakHashMap

get

public Object get(Object key)
Overrides:
get in class WeakHashMap

entrySet

public Set entrySet()
Overrides:
entrySet in class WeakHashMap

Copyright (c) 1996-1999
Massachusetts Institute of Technology

Feedback: jeva-feedback@ai.mit.edu