Package ghidra.util.datastruct
Class WeakSet<T>
java.lang.Object
ghidra.util.datastruct.WeakSet<T>
- All Implemented Interfaces:
Iterable<T>
,Collection<T>
,Set<T>
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionabstract boolean
Add the given object to the setabstract boolean
addAll
(Collection<? extends T> c) abstract void
clear()
Remove all elements from this data structureabstract boolean
Returns true if the given object is in this data structureboolean
containsAll
(Collection<?> c) abstract boolean
isEmpty()
Return whether this data structure is emptyprotected void
Looks for situations where clients may lose the values added to this class.abstract boolean
Remove the given object from the data structureabstract boolean
removeAll
(Collection<?> c) abstract boolean
retainAll
(Collection<?> c) abstract int
size()
Return the number of objects contained within this data structurestream()
Returns a stream of the values of this collection.Object[]
toArray()
<T> T[]
toArray
(T[] a) abstract Collection
<T> values()
Returns a Collection view of this set.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.Collection
parallelStream, removeIf, toArray
Methods inherited from interface java.util.Set
equals, hashCode, iterator, spliterator
-
Field Details
-
weakHashStorage
-
-
Constructor Details
-
WeakSet
public WeakSet()
-
-
Method Details
-
maybeWarnAboutAnonymousValue
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
Add the given object to the set -
remove
Remove the given object from the data structure -
contains
Returns true if the given object is in this data structure -
clear
public abstract void clear()Remove all elements from this data structure -
size
public abstract int size()Return the number of objects contained within this data structure -
isEmpty
public abstract boolean isEmpty()Return whether this data structure is empty -
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
-
toArray
public <T> T[] toArray(T[] a) -
containsAll
- Specified by:
containsAll
in interfaceCollection<T>
- Specified by:
containsAll
in interfaceSet<T>
-
addAll
-
retainAll
-
removeAll
-
stream
Returns a stream of the values of this collection.- Specified by:
stream
in interfaceCollection<T>
- Returns:
- a stream of the values of this collection.
-