Package ghidra.util.datastruct
Class AbstractWeakValueMap<K,V>
java.lang.Object
ghidra.util.datastruct.AbstractWeakValueMap<K,V>
- Type Parameters:
K
- the type of keysV
- the type of values
- All Implemented Interfaces:
Map<K,
V>
- Direct Known Subclasses:
AbstractWeakValueNavigableMap
,WeakValueHashMap
Class to provide a map with weak values, backed by a given map
-
Nested Class Summary
Modifier and TypeClassDescriptionprotected class
An entry for the "entrySet" method, since internally, entries are of weak-referenced values.protected static class
A weak value ref that also knows its key in the map. -
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
boolean
containsKey
(Object key) boolean
containsValue
(Object value) entrySet()
protected abstract Map
<K, AbstractWeakValueMap.WeakValueRef<K, V>> Returns the backing mapboolean
isEmpty()
keySet()
protected void
void
int
size()
values()
Returns aCollection
view of the values contained in this map.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, equals, forEach, getOrDefault, hashCode, merge, putIfAbsent, remove, replace, replace, replaceAll
-
Field Details
-
refQueue
-
-
Constructor Details
-
AbstractWeakValueMap
protected AbstractWeakValueMap()Constructs a new weak map
-
-
Method Details
-
getRefMap
Returns the backing map- Returns:
- the map
-
put
-
get
-
size
public int size() -
clear
public void clear() -
isEmpty
public boolean isEmpty() -
containsKey
- Specified by:
containsKey
in interfaceMap<K,
V>
-
containsValue
- Specified by:
containsValue
in interfaceMap<K,
V>
-
values
Returns aCollection
view of the values contained in this map. The collection is backed by the map, so changes to the map are reflected in the collection, and vice-versa. However, since values in this map are held via weak references, the collection returned is effectively weak in that any time, values may disappear from the collection. To get a static view of the values in this map, you should construct another collection class (List, Set, etc.) and pass this collection to it in its constructor. -
putAll
-
entrySet
-
keySet
-
remove
-
processQueue
protected void processQueue()
-