org.scalactic

HashingEquality

trait HashingEquality[T] extends Equality[T]

An Equality[T] that offers a hashCodeFor method that can provide an Int hash code for a given T instance, whose contract is constrainted by that of areEqual.

The general contract of hashCodeFor is:

- Whenever hashCodeFor is passed on the same object more than once during an execution an application, hashCodeFor must consistently return the same integer, provided no information used in areEqual comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.

- If two objects are equal according to the areEqual method, then passing either of those objects to the hashCodeFor method must produce the same integer result.

- It is not required that if two objects are unequal according to the areEqual method, then calling the hashCodeFor method on each of the two objects must produce distinct integer results. However, you should be aware that producing distinct integer results for unequal objects may improve the performance of hashtables.

Trait HashingEquality is used by instances of EquaPath#EquaSet to implement hash sets based on custom equalities.

Source
HashingEquality.scala
Linear Supertypes
Equality[T], Equivalence[T], AnyRef, Any
Known Subclasses
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. HashingEquality
  2. Equality
  3. Equivalence
  4. AnyRef
  5. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Abstract Value Members

  1. abstract def areEqual(a: T, b: Any): Boolean

    Indicates whether the objects passed as a and b are equal.

    Indicates whether the objects passed as a and b are equal.

    a

    a left-hand value being compared with another (right-hand-side one) for equality (e.g., a == b)

    b

    a right-hand value being compared with another (left-hand-side one) for equality (e.g., a == b)

    returns

    true if the passed objects are "equal," as defined by this Equality instance

    Definition Classes
    Equality
  2. abstract def hashCodeFor(a: T): Int

    Returns a hash code for the specified object that is consistent with areEqual.

    Returns a hash code for the specified object that is consistent with areEqual.

    See the main documentation of this trait for more detail on the contract of hashCodeFor.

Concrete Value Members

  1. final def !=(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  4. final def areEquivalent(a: T, b: T): Boolean

    A final implementation of the areEquivalent method of Equivalence that just passes a and b to areEqual and returns the result.

    A final implementation of the areEquivalent method of Equivalence that just passes a and b to areEqual and returns the result.

    This method enables any Equality to be used where an Equivalence is needed, such as the implicit enabling methods of TypeCheckedTripleEquals and ConversionCheckedTripleEquals.

    a

    a left-hand value being compared with another, right-hand, value for equality (e.g., a == b)

    b

    a right-hand value being compared with another, left-hand, value for equality (e.g., a == b)

    returns

    true if the passed objects are "equal," as defined by the areEqual method of this Equality instance

    Definition Classes
    EqualityEquivalence
  5. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  6. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  7. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  8. def equals(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  9. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  10. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  11. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  12. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  13. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  14. final def notify(): Unit

    Definition Classes
    AnyRef
  15. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  16. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  17. def toString(): String

    Definition Classes
    AnyRef → Any
  18. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  19. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  20. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from Equality[T]

Inherited from Equivalence[T]

Inherited from AnyRef

Inherited from Any

Ungrouped