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

    • DEFAULT

      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

      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

      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

    • Equivalence

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

    • equals

      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

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