hashCode

override fun hashCode(): Int

Returns a hash code value for this email address.


Calling from Kotlin

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

val text = "[email protected]"
val hashCode: Int = EmailAddress.of(text)
?.hashCode()
?: fail()
val other: Int = EmailAddress.of(text)
?.hashCode()
?: fail()
assertEquals(hashCode, other)

Calling from Java

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

final String text = "[email protected]";
final EmailAddress address1 = EmailAddress.of(text);
Assertions.assertNotNull(address1);
final int hashCode1 = address1.hashCode();
final EmailAddress address2 = EmailAddress.of(text);
Assertions.assertNotNull(address2);
final int hashCode2 = address2.hashCode();
final boolean result = hashCode1 == hashCode2;
Assertions.assertTrue(result);