hashCode
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)
Content copied to clipboard
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);
Content copied to clipboard