com.sun.jini.collection
Class SoftCache
java.lang.Object
com.sun.jini.collection.SoftCache
public class SoftCache
- extends Object
Map of keys to softly-referenced values which automatically removes mappings
for garbage-collected values. This is a simplified version of
sun.misc.SoftCache.
- Since:
- 2.0
- Author:
- Sun Microsystems, Inc.
Method Summary |
void |
clear()
Removes all associations from this map. |
Object |
get(Object key)
Returns value associated with given key, or null if none. |
private void |
processQueue()
|
Object |
put(Object key,
Object value)
Associates value with given key, returning value previously associated
with key, or null if none. |
Object |
remove(Object key)
Removes association for given key, returning value previously associated
with key, or null if none. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
map
private final Map map
queue
private final ReferenceQueue queue
SoftCache
public SoftCache()
put
public Object put(Object key,
Object value)
- Associates value with given key, returning value previously associated
with key, or null if none.
get
public Object get(Object key)
- Returns value associated with given key, or null if none.
remove
public Object remove(Object key)
- Removes association for given key, returning value previously associated
with key, or null if none.
clear
public void clear()
- Removes all associations from this map.
processQueue
private void processQueue()
Copyright 2007-2010, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.