class MildValues<K,V>
extends java.lang.Object
implements java.util.Map<K,V>
Map
whose values are kept alive by soft/weak Reference
s.Modifier and Type | Class and Description |
---|---|
(package private) class |
MildValues.EntryItr
Iterator that iterates over reachable entries in the map. |
(package private) static interface |
MildValues.InverseMapping
Represents an inverse mapping from a value to its key.
|
private static class |
MildValues.Soft<K,V>
Soft value with an
MildValues.InverseMapping back to its key. |
(package private) class |
MildValues.StrongEntry
Entry that delegates to the original entry, but maintains a strong reference to the value. |
(package private) class |
MildValues.ValueItr
Iterator that iterates over reachable values in the map. |
private static class |
MildValues.Weak<K,V>
Weak value with an
MildValues.InverseMapping back to its key. |
Modifier and Type | Field and Description |
---|---|
(package private) java.util.Map<K,java.lang.ref.Reference<V>> |
map |
(package private) java.lang.ref.ReferenceQueue<V> |
queue |
private boolean |
soft |
Constructor and Description |
---|
MildValues(java.util.Map<K,java.lang.ref.Reference<V>> map,
boolean soft) |
Modifier and Type | Method and Description |
---|---|
void |
clear() |
(package private) void |
compact()
Compacts the map by removing cleared values.
|
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<V> |
mildValue(K key,
V value) |
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 <V> java.lang.ref.Reference<V> |
tempValue(V value) |
java.util.Collection<V> |
values() |
final java.lang.ref.ReferenceQueue<V> 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<V> mildValue(K key, V value)
Reference
for the given key-value mapping.static final <V> java.lang.ref.Reference<V> tempValue(V value)
Reference
for the given value; used in queries.void compact()