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-safeMapwhose values are kept alive by soft/weakReferences.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) classMildValues.EntryItrIteratorthat iterates over reachable entries in the map.(package private) static interfaceMildValues.InverseMappingRepresents an inverse mapping from a value to its key.private static classMildValues.Soft<K,V>Soft value with anMildValues.InverseMappingback to its key.(package private) classMildValues.StrongEntryMap.Entrythat delegates to the original entry, but maintains a strong reference to the value.(package private) classMildValues.ValueItrIteratorthat iterates over reachable values in the map.private static classMildValues.Weak<K,V>Weak value with anMildValues.InverseMappingback 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 voidclear()(package private) voidcompact()Compacts the map by removing cleared values.booleancontainsKey(java.lang.Object key)booleancontainsValue(java.lang.Object value)java.util.Set<java.util.Map.Entry<K,V>>entrySet()Vget(java.lang.Object key)booleanisEmpty()java.util.Set<K>keySet()(package private) java.lang.ref.Reference<V>mildValue(K key, V value)Vput(K key, V value)voidputAll(java.util.Map<? extends K,? extends V> m)Vremove(java.lang.Object key)intsize()(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
Referencefor the given key-value mapping.
-
tempValue
static final <V> java.lang.ref.Reference<V> tempValue(V value)
- Returns:
- Temporary
Referencefor the given value; used in queries.
-
compact
void compact()
Compacts the map by removing cleared values.
-
-