Class IDKey

java.lang.Object
org.apache.commons.lang3.builder.IDKey

final class IDKey extends Object
Wrap an identity key (System.identityHashCode()) so that an object can only be equal() to itself. This is necessary to disambiguate the occasional duplicate identityHashCodes that can occur.
  • Field Details

    • value

      private final Object value
    • id

      private final int id
  • Constructor Details

    • IDKey

      IDKey(Object value)
      Constructor for IDKey
      Parameters:
      value - The value
  • Method Details

    • equals

      public boolean equals(Object other)
      checks if instances are equal
      Overrides:
      equals in class Object
      Parameters:
      other - The other object to compare to
      Returns:
      if the instances are for the same object
    • hashCode

      public int hashCode()
      returns hash code - i.e. the system identity hash code.
      Overrides:
      hashCode in class Object
      Returns:
      the hash code