Class WeakSet<T>

java.lang.Object
ghidra.util.datastruct.WeakSet<T>
All Implemented Interfaces:
Iterable<T>, Collection<T>, Set<T>

public abstract class WeakSet<T> extends Object implements Set<T>
  • Field Details

  • Constructor Details

    • WeakSet

      public WeakSet()
  • Method Details

    • maybeWarnAboutAnonymousValue

      protected void maybeWarnAboutAnonymousValue(T t)
      Looks for situations where clients may lose the values added to this class. This most often happens when a client adds an anonymous, local listener to an object that is using a WeakSet to store its listeners. Our policy is to implement listeners at the class field level so that they will not be flagged by this method.
      Parameters:
      t - The object to check
    • add

      public abstract boolean add(T t)
      Add the given object to the set
      Specified by:
      add in interface Collection<T>
      Specified by:
      add in interface Set<T>
      Parameters:
      t - the object to add
    • remove

      public abstract boolean remove(Object t)
      Remove the given object from the data structure
      Specified by:
      remove in interface Collection<T>
      Specified by:
      remove in interface Set<T>
      Parameters:
      t - the object to remove
    • contains

      public abstract boolean contains(Object t)
      Returns true if the given object is in this data structure
      Specified by:
      contains in interface Collection<T>
      Specified by:
      contains in interface Set<T>
      Parameters:
      t - the object
      Returns:
      true if the given object is in this data structure
    • clear

      public abstract void clear()
      Remove all elements from this data structure
      Specified by:
      clear in interface Collection<T>
      Specified by:
      clear in interface Set<T>
    • size

      public abstract int size()
      Return the number of objects contained within this data structure
      Specified by:
      size in interface Collection<T>
      Specified by:
      size in interface Set<T>
      Returns:
      the size
    • isEmpty

      public abstract boolean isEmpty()
      Return whether this data structure is empty
      Specified by:
      isEmpty in interface Collection<T>
      Specified by:
      isEmpty in interface Set<T>
      Returns:
      whether this data structure is empty
    • values

      public abstract Collection<T> values()
      Returns a Collection view of this set. The returned Collection is backed by this set.
      Returns:
      a Collection view of this set. The returned Collection is backed by this set.
    • toArray

      public Object[] toArray()
      Specified by:
      toArray in interface Collection<T>
      Specified by:
      toArray in interface Set<T>
    • toArray

      public <T> T[] toArray(T[] a)
      Specified by:
      toArray in interface Collection<T>
      Specified by:
      toArray in interface Set<T>
    • containsAll

      public boolean containsAll(Collection<?> c)
      Specified by:
      containsAll in interface Collection<T>
      Specified by:
      containsAll in interface Set<T>
    • addAll

      public abstract boolean addAll(Collection<? extends T> c)
      Specified by:
      addAll in interface Collection<T>
      Specified by:
      addAll in interface Set<T>
    • retainAll

      public abstract boolean retainAll(Collection<?> c)
      Specified by:
      retainAll in interface Collection<T>
      Specified by:
      retainAll in interface Set<T>
    • removeAll

      public abstract boolean removeAll(Collection<?> c)
      Specified by:
      removeAll in interface Collection<T>
      Specified by:
      removeAll in interface Set<T>
    • stream

      public abstract Stream<T> stream()
      Returns a stream of the values of this collection.
      Specified by:
      stream in interface Collection<T>
      Returns:
      a stream of the values of this collection.