Class WeakStore<T>

java.lang.Object
ghidra.util.datastruct.WeakStore<T>
Type Parameters:
T - The type of objects stored in this WeakStore

public class WeakStore<T> extends Object
Class for storing a weak reference to object instances. Objects of type T can be placed in this store and they will remain there until there are no references to that object. Note that this is not a Set and you can have multiple instances that are "equal" in this store.The main purpose of this store is to be able to get all objects in the store that are still referenced. This is useful when you need to visit all in use items.

This class is thread safe.

  • Field Details

  • Constructor Details

    • WeakStore

      public WeakStore()
  • Method Details

    • size

      public int size()
      Returns the number of objects of type T remaining in the store. Those that are remaining are either still referenced
      Returns:
      the number of objects still in the store that haven't yet been garbage collected
    • getValues

      public List<T> getValues()
      returns a list of all the objects in this store
      Returns:
      a list of all the objects in this store
    • add

      public void add(T value)
      Adds the given value to the store
      Parameters:
      value - the instance being added to the store