Class AbstractWeakValueMap<K,V>

java.lang.Object
ghidra.util.datastruct.AbstractWeakValueMap<K,V>
Type Parameters:
K - the type of keys
V - the type of values
All Implemented Interfaces:
Map<K,V>
Direct Known Subclasses:
AbstractWeakValueNavigableMap, WeakValueHashMap

public abstract class AbstractWeakValueMap<K,V> extends Object implements Map<K,V>
Class to provide a map with weak values, backed by a given map
  • Field Details

  • Constructor Details

    • AbstractWeakValueMap

      protected AbstractWeakValueMap()
      Constructs a new weak map
  • Method Details

    • getRefMap

      protected abstract Map<K,AbstractWeakValueMap.WeakValueRef<K,V>> getRefMap()
      Returns the backing map
      Returns:
      the map
    • put

      public V put(K key, V value)
      Specified by:
      put in interface Map<K,V>
    • get

      public V get(Object key)
      Specified by:
      get in interface Map<K,V>
    • size

      public int size()
      Specified by:
      size in interface Map<K,V>
    • clear

      public void clear()
      Specified by:
      clear in interface Map<K,V>
    • isEmpty

      public boolean isEmpty()
      Specified by:
      isEmpty in interface Map<K,V>
    • containsKey

      public boolean containsKey(Object key)
      Specified by:
      containsKey in interface Map<K,V>
    • containsValue

      public boolean containsValue(Object value)
      Specified by:
      containsValue in interface Map<K,V>
    • values

      public Collection<V> values()
      Returns a Collection 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.
      Specified by:
      values in interface Map<K,V>
    • putAll

      public void putAll(Map<? extends K,? extends V> map)
      Specified by:
      putAll in interface Map<K,V>
    • entrySet

      public Set<Map.Entry<K,V>> entrySet()
      Specified by:
      entrySet in interface Map<K,V>
    • keySet

      public Set<K> keySet()
      Specified by:
      keySet in interface Map<K,V>
    • remove

      public V remove(Object key)
      Specified by:
      remove in interface Map<K,V>
    • processQueue

      protected void processQueue()