Package io.deephaven.util.datastructures
Class WeakIdentityHashSet<TYPE>
java.lang.Object
io.deephaven.util.datastructures.WeakIdentityHashSet<TYPE>
- Direct Known Subclasses:
WeakIdentityHashSet.Synchronized
An open-addressed identity hash set that only maintains weak references to its members. Only supports
add(TYPE)
and clear()
. See WeakIdentityHashSet.Synchronized
variant for concurrent usage.-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Thread-safe implementation. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Add a value to the set if its not already present.boolean
add
(TYPE value, @Nullable WeakReference<? extends TYPE> valueReference) Add a value to the set if its not already present.void
clear()
Clear the set.void
Invoke an action on each member of the set.
-
Constructor Details
-
WeakIdentityHashSet
public WeakIdentityHashSet()
-
-
Method Details
-
clear
public void clear()Clear the set. -
add
Add a value to the set if its not already present.- Parameters:
value
- The value to add- Returns:
- True if the value was added to the set
-
add
public boolean add(@NotNull TYPE value, @Nullable @Nullable WeakReference<? extends TYPE> valueReference) Add a value to the set if its not already present.- Parameters:
value
- The value to addvalueReference
- A re-usable WeakReference to value if already available, else null- Returns:
- True if the value was added to the set
-
forEach
Invoke an action on each member of the set.- Parameters:
action
- The action to invoke
-