Class IdentityHashSet

java.lang.Object
org.github.jamm.IdentityHashSet

public final class IdentityHashSet extends Object
Simple set that use object equality to compare elements. This set is used in MemoryMeter to keep track of the objects already visited to avoid circular dependencies.

This class provides constant-time performance for the add operation, assuming the system identity hash function (System.identityHashCode(Object)) disperses elements properly among the buckets.

IdentityHashSet uses linear probing to resolve hash collisions. When a hash collision occurs it will look for the next null bucket available. To minimize the risk of clustering impacting the performance, IdentityHashSet will ensure that the underlying array is at most 2/3 full by resizing the array when this limit is reached.

  • Constructor Details

    • IdentityHashSet

      public IdentityHashSet()