class MildKeys<K,V>
extends java.lang.Object
implements java.util.Map<K,V>
Map
whose keys are kept alive by soft/weak Reference
s.Modifier and Type | Class and Description |
---|---|
(package private) class |
MildKeys.EntryItr
Iterator that iterates over reachable entries in the map. |
(package private) class |
MildKeys.KeyItr
Iterator that iterates over reachable keys in the map. |
(package private) static class |
MildKeys.Soft<T>
Soft key that maintains a constant hash and uses referential equality.
|
(package private) class |
MildKeys.StrongEntry
Entry that delegates to the original entry, but maintains a strong reference to the key. |
(package private) static class |
MildKeys.Weak<T>
Weak key that maintains a constant hash and uses referential equality.
|
Modifier and Type | Field and Description |
---|---|
(package private) java.util.Map<java.lang.ref.Reference<K>,V> |
map |
(package private) java.lang.ref.ReferenceQueue<K> |
queue |
private boolean |
soft |
Constructor and Description |
---|
MildKeys(java.util.Map<java.lang.ref.Reference<K>,V> map,
boolean soft) |
Modifier and Type | Method and Description |
---|---|
void |
clear() |
(package private) void |
compact()
Compacts the map by removing cleared keys.
|
boolean |
containsKey(java.lang.Object key) |
boolean |
containsValue(java.lang.Object value) |
java.util.Set<java.util.Map.Entry<K,V>> |
entrySet() |
V |
get(java.lang.Object key) |
boolean |
isEmpty() |
java.util.Set<K> |
keySet() |
(package private) java.lang.ref.Reference<K> |
mildKey(K key) |
V |
put(K key,
V value) |
void |
putAll(java.util.Map<? extends K,? extends V> m) |
V |
remove(java.lang.Object key) |
int |
size() |
(package private) static <K> java.lang.ref.Reference<K> |
tempKey(K key) |
java.util.Collection<V> |
values() |
final java.lang.ref.ReferenceQueue<K> queue
private final boolean soft
public final boolean containsKey(java.lang.Object key)
public final boolean containsValue(java.lang.Object value)
public final V remove(java.lang.Object key)
public final java.util.Collection<V> values()
final java.lang.ref.Reference<K> mildKey(K key)
Reference
for the given key.static final <K> java.lang.ref.Reference<K> tempKey(K key)
Reference
for the given key; used in queries.final void compact()