|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.erights.e.elib.tables.EMap | +--org.erights.e.elib.tables.FlexMap | +--org.erights.e.elib.tables.WeakKeyMap
Untamed: A WeakKeyMap is a FlexMap whose keys may be garbage collected.
A WeakKeyMap acts as if an external entity (ie, the garbage collector) shares access to the map and occasionally decides to remove some elements. As a result, a WeakKeyMap which isn't being changed by the program may nevertheless find itself shrinking over time. This external modifications can only occur 1) in their own turn, or 2) at the beginning of any operation that causes an enumeration.
The snapshot(), readOnly(), clone(), or diverge() of a WeakKeyMap is not weak.
XXX This class needs its own writeReplace() method.
java.util.WeakHashMap
,
Serialized FormField Summary | |
private Class |
myKeyType
|
private FlexMap |
myStuff
|
(package private) static long |
serialVersionUID
|
Fields inherited from class org.erights.e.elib.tables.EMap |
|
Fields inherited from interface org.erights.e.elib.serial.PassByProxy |
HONORARY, HONORED_NAMES |
Fields inherited from interface org.erights.e.elib.serial.Persistent |
HONORARY, HONORED_NAMES |
Constructor Summary | |
WeakKeyMap()
Enabled: |
|
WeakKeyMap(Class keyType,
Class valueType)
Enabled: |
Method Summary | |
void |
__printOn(TextWriter out)
Enabled: Does not remove garbage first, which is weird, but the other would be weirder. |
boolean |
contains(Object candidate)
Enabled: Removes garbage first |
Object |
get(Object key,
Object instead)
Enabled: Does not remove garbage first, but cannot retrieve garbage since the key cannot be supplied. |
Object |
getKeys(Class type)
Enabled: Removes garbage first |
Object |
getValues(Class type)
Enabled: Does *not* remove garbage first, which is dangerous. |
Class |
keyType()
Enabled: Does not remove garbage first |
void |
put(Object key,
Object value,
boolean strict)
Enabled: Does not remove garbage first. |
void |
removeAll()
Enabled: Does not remove garbage first |
void |
removeKey(Object key,
boolean strict)
Enabled: Does not remove garbage first. |
int |
size()
Enabled: Does *not* remove garbage first, but affected when garbage is removed. |
Class |
valueType()
Enabled: Does not remove garbage first |
Methods inherited from class org.erights.e.elib.tables.FlexMap |
__optUncall, clone, domain, fromColumns, fromPairs, fromTypes, fromTypes, interning, interning, make, make, put, putAll, putAll, readOnly, removeKey, removeKeys, removeKeys, snapshot |
Methods inherited from class org.erights.e.elib.tables.EMap |
and, butNot, diverge, diverge, extract, get, getKeys, getPair, getPair, getValues, intersects, iterate, maps, optExtract, or, or, printOn, sortKeys, sortKeys, sortValues, sortValues, toString, with, without |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
static final long serialVersionUID
private final Class myKeyType
private final FlexMap myStuff
Constructor Detail |
public WeakKeyMap(Class keyType, Class valueType)
public WeakKeyMap()
Method Detail |
public int size()
size
in class EMap
public boolean contains(Object candidate)
contains
in class EMap
public Object getKeys(Class type)
getKeys
in class EMap
public Object getValues(Class type)
When used in concert with getKeys, be sure to call getKeys first and hold on to the result when calling getValues, so that none of the keys will be become garbage between the two operations.
Or, better yet, just call getPair(), which is safe on all kinds of maps.
getValues
in class EMap
public Class keyType()
keyType
in class EMap
public Class valueType()
valueType
in class EMap
public Object get(Object key, Object instead)
get
in class EMap
key
- nullOk;instead
- nullOk;
org.erights.e.elib.ref.Ref#isSettled
public void put(Object key, Object value, boolean strict)
WeakKeyMap doesn't support strict=true.
put
in class FlexMap
org.erights.e.elib.ref.Ref#isSettled
public void removeKey(Object key, boolean strict)
WeakKeyMap doesn't support strict=true.
removeKey
in class FlexMap
key
- the key to removepublic void removeAll()
removeAll
in class FlexMap
public void __printOn(TextWriter out) throws IOException
__printOn
in interface EPrintable
__printOn
in class FlexMap
IOException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |