Module stormpot

Class IdentityHashSet

java.lang.Object
stormpot.internal.IdentityHashSet
All Implemented Interfaces:
Iterable<Object>

public final class IdentityHashSet extends Object implements Iterable<Object>
Like IdentityHashMap, but as a Set with no overhead for storing values.
  • Constructor Details

    • IdentityHashSet

      public IdentityHashSet()
      Create an empty identity hash set that uses System.identityHashCode(Object) as the hash code for entries.
    • IdentityHashSet

      public IdentityHashSet(ToIntFunction<Object> hashCode)
      Create an empty identity hash set that uses the given function as the hash code for entries.
      Parameters:
      hashCode - A function that converts a given object into a reasonably unique integer.
  • Method Details

    • add

      public void add(Object obj)
      Add the given object to the set.
      Parameters:
      obj - The object to add.
    • remove

      public void remove(Object obj)
      Remove the given object from the set.
      Parameters:
      obj - The object to remove.
    • iterator

      public Iterator<Object> iterator()
      Specified by:
      iterator in interface Iterable<Object>