Class IDKey


  • final class IDKey
    extends java.lang.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 Summary

      Fields 
      Modifier and Type Field Description
      private int id  
      private java.lang.Object value  
    • Constructor Summary

      Constructors 
      Constructor Description
      IDKey​(java.lang.Object value)
      Constructs new instance.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object other)
      Tests if instances are equal.
      int hashCode()
      Gets the hash code, the system identity hash code.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • value

        private final java.lang.Object value
      • id

        private final int id
    • Constructor Detail

      • IDKey

        IDKey​(java.lang.Object value)
        Constructs new instance.
        Parameters:
        value - The value
    • Method Detail

      • equals

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

        public int hashCode()
        Gets the hash code, the system identity hash code.
        Overrides:
        hashCode in class java.lang.Object
        Returns:
        the hash code.