Class WeakIdentityHashSet<TYPE>

java.lang.Object
io.deephaven.util.datastructures.WeakIdentityHashSet<TYPE>
Direct Known Subclasses:
WeakIdentityHashSet.Synchronized

public class WeakIdentityHashSet<TYPE> extends Object
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.
  • Constructor Details

    • WeakIdentityHashSet

      public WeakIdentityHashSet()
  • Method Details

    • clear

      public void clear()
      Clear the set.
    • add

      public boolean add(@NotNull TYPE value)
      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 add
      valueReference - A re-usable WeakReference to value if already available, else null
      Returns:
      True if the value was added to the set
    • forEach

      public void forEach(@NotNull @NotNull Consumer<? super TYPE> action)
      Invoke an action on each member of the set.
      Parameters:
      action - The action to invoke