hashCode

override fun hashCode(): Int

Returns a hash code value for this floating-point number.


Calling from Kotlin

Here's an example of calling this function from Kotlin code:

val number: Number = -23
val first: StrictlyNegativeDouble =
StrictlyNegativeDouble.create(number)
val second: StrictlyNegativeDouble =
StrictlyNegativeDouble.create(number)
val actual: Boolean = first.hashCode() == second.hashCode()
assertTrue(actual)

Calling from Java

Here's an example of calling this function from Java code:

final Number number = -23;
final int firstHashCode = StrictlyNegativeDouble.Companion
.create(number)
.hashCode();
final int secondHashCode = StrictlyNegativeDouble.Companion
.create(number)
.hashCode();
Assertions.assertEquals(firstHashCode, secondHashCode);