Class Equivalence

java.lang.Object
org.graalvm.collections.Equivalence

public abstract class Equivalence extends Object
Strategy for comparing two objects. Default predefined strategies are DEFAULT, IDENTITY, and IDENTITY_WITH_SYSTEM_HASHCODE.
Since:
19.0
  • Field Details Link icon

    • DEFAULT Link icon

      public static final Equivalence DEFAULT
      Default equivalence calling Object.equals(Object) to check equality and Object.hashCode() for obtaining hash values. Do not change the logic of this class as it may be inlined in other places.
      Since:
      19.0
    • IDENTITY Link icon

      public static final Equivalence IDENTITY
      Identity equivalence using == to check equality and Object.hashCode() for obtaining hash values. Do not change the logic of this class as it may be inlined in other places.
      Since:
      19.0
    • IDENTITY_WITH_SYSTEM_HASHCODE Link icon

      public static final Equivalence IDENTITY_WITH_SYSTEM_HASHCODE
      Identity equivalence using == to check equality and System.identityHashCode(Object) for obtaining hash values. Do not change the logic of this class as it may be inlined in other places.
      Since:
      19.0
  • Constructor Details Link icon

    • Equivalence Link icon

      protected Equivalence()
      Subclass for creating custom equivalence definitions.
      Since:
      19.0
  • Method Details Link icon

    • equals Link icon

      public abstract boolean equals(Object a, Object b)
      Returns true if the non-null arguments are equal to each other and false otherwise.
      Since:
      19.0
    • hashCode Link icon

      public abstract int hashCode(Object o)
      Returns the hash code of a non-null argument o.
      Since:
      19.0