Package ghidra.util.datastruct
Class WeakSet<T>
- java.lang.Object
- 
- ghidra.util.datastruct.WeakSet<T>
 
- 
- All Implemented Interfaces:
- java.lang.Iterable<T>
 - Direct Known Subclasses:
- CopyOnReadWeakSet
 
 public abstract class WeakSet<T> extends java.lang.Object implements java.lang.Iterable<T>
- 
- 
Field SummaryFields Modifier and Type Field Description protected java.util.WeakHashMap<T,T>weakHashStorage
 - 
Constructor SummaryConstructors Constructor Description WeakSet()
 - 
Method SummaryAll Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract voidadd(T t)Add the given object to the setabstract voidclear()Remove all elements from this data structureabstract booleancontains(T t)Returns true if the given object is in this data structureabstract booleanisEmpty()Return whether this data structure is emptyprotected voidmaybeWarnAboutAnonymousValue(T t)Looks for situations where clients may lose the values added to this class.abstract voidremove(T t)Remove the given object from the data structureabstract intsize()Return the number of objects contained within this data structurejava.util.stream.Stream<T>stream()Returns a stream of the values of this collection.java.lang.StringtoString()abstract java.util.Collection<T>values()Returns a Collection view of this set.
 
- 
- 
- 
Method Detail- 
maybeWarnAboutAnonymousValueprotected 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
 
 - 
addpublic abstract void add(T t) Add the given object to the set- Parameters:
- t- the object to add
 
 - 
removepublic abstract void remove(T t) Remove the given object from the data structure- Parameters:
- t- the object to remove
 
 - 
containspublic abstract boolean contains(T t) Returns true if the given object is in this data structure- Returns:
- true if the given object is in this data structure
 
 - 
clearpublic abstract void clear() Remove all elements from this data structure
 - 
sizepublic abstract int size() Return the number of objects contained within this data structure- Returns:
- the size
 
 - 
isEmptypublic abstract boolean isEmpty() Return whether this data structure is empty- Returns:
- whether this data structure is empty
 
 - 
valuespublic abstract java.util.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.
 
 - 
streampublic java.util.stream.Stream<T> stream() Returns a stream of the values of this collection.- Returns:
- a stream of the values of this collection.
 
 - 
toStringpublic java.lang.String toString() - Overrides:
- toStringin class- java.lang.Object
 
 
- 
 
-