thinkmap.server
Class SoftCache

java.lang.Object
  extended by java.util.AbstractMap
      extended by thinkmap.server.SoftCache
All Implemented Interfaces:
Map

public class SoftCache
extends AbstractMap
implements Map

SoftCache caches objects, but allows them to be garbage collected if necessary.

Version:
$Revision: 1.1 $

Nested Class Summary
 
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>
 
Constructor Summary
SoftCache()
          Creates a new SoftCache object.
SoftCache(int initialCapacity)
          Creates a new SoftCache object.
SoftCache(int initialCapacity, float loadFactor)
          Creates a new SoftCache object.
SoftCache(Map m)
          Creates a new SoftCache object containing objects from the specified Map.
 
Method Summary
 void clear()
           
 boolean containsKey(Object key)
           
 Set entrySet()
           
 Object get(Object key)
           
 boolean isEmpty()
           
 Object put(Object key, Object value)
           
 Object remove(Object key)
           
 int size()
           
 
Methods inherited from class java.util.AbstractMap
clone, containsValue, equals, hashCode, keySet, putAll, toString, values
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
containsValue, equals, hashCode, keySet, putAll, values
 

Constructor Detail

SoftCache

public SoftCache(int initialCapacity,
                 float loadFactor)
Creates a new SoftCache object.

Parameters:
initialCapacity - intial capacity of the cache
loadFactor - load factor of the cache

SoftCache

public SoftCache(int initialCapacity)
Creates a new SoftCache object.

Parameters:
initialCapacity - initial capacity of the cache

SoftCache

public SoftCache()
Creates a new SoftCache object.


SoftCache

public SoftCache(Map m)
Creates a new SoftCache object containing objects from the specified Map.

Parameters:
m - a map whose elements will be cached
Method Detail

size

public int size()
Specified by:
size in interface Map
Overrides:
size in class AbstractMap

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface Map
Overrides:
isEmpty in class AbstractMap

containsKey

public boolean containsKey(Object key)
Specified by:
containsKey in interface Map
Overrides:
containsKey in class AbstractMap

get

public Object get(Object key)
Specified by:
get in interface Map
Overrides:
get in class AbstractMap

put

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

remove

public Object remove(Object key)
Specified by:
remove in interface Map
Overrides:
remove in class AbstractMap

clear

public void clear()
Specified by:
clear in interface Map
Overrides:
clear in class AbstractMap

entrySet

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


Copyright © 2013 Thinkmap, Inc. All Rights Reserved.