Package org.eclipse.sisu.inject
Class MildValues<K,V>
- java.lang.Object
-
- org.eclipse.sisu.inject.MildValues<K,V>
-
- All Implemented Interfaces:
java.util.Map<K,V>
- Direct Known Subclasses:
MildConcurrentValues
class MildValues<K,V> extends java.lang.Object implements java.util.Map<K,V>
NON-thread-safeMap
whose values are kept alive by soft/weakReference
s.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class 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 anMildValues.InverseMapping
back to its key.(package private) class
MildValues.StrongEntry
Map.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 anMildValues.InverseMapping
back to its key.
-
Constructor Summary
Constructors Constructor Description MildValues(java.util.Map<K,java.lang.ref.Reference<V>> map, boolean soft)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method 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()
-
-
-
Method Detail
-
containsKey
public final boolean containsKey(java.lang.Object key)
-
containsValue
public final boolean containsValue(java.lang.Object value)
-
remove
public final V remove(java.lang.Object key)
-
values
public final java.util.Collection<V> values()
-
mildValue
final java.lang.ref.Reference<V> mildValue(K key, V value)
- Returns:
- Soft or weak
Reference
for the given key-value mapping.
-
tempValue
static final <V> java.lang.ref.Reference<V> tempValue(V value)
- Returns:
- Temporary
Reference
for the given value; used in queries.
-
compact
void compact()
Compacts the map by removing cleared values.
-
-