equals

operator override fun equals(other: Any?): Boolean

Returns true if the other object is an instance of EmailAddress and has the same string representation as this email address, or returns false otherwise.


Calling from Kotlin

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

val text = "[email protected]"
val first: EmailAddress = EmailAddress.orThrow(text)
val second: EmailAddress = EmailAddress.orThrow(text)
val actual: Boolean = first == second // or first.equals(second)
assertTrue(actual)

Calling from Java

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

final String text = "[email protected]";
final EmailAddress first = EmailAddress.orThrow(text);
final EmailAddress second = EmailAddress.orThrow(text);
final boolean actual = first.equals(second);
Assertions.assertTrue(actual);