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 function from Kotlin code:

val text: Any = "contact@kotools.org"
val first: EmailAddress = EmailAddress.fromString(text)
val second: EmailAddress = EmailAddress.fromString(text)
val actual: Boolean = first == second // or first.equals(second)
assertTrue(actual)

Calling from Java

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

final Object text = "contact@kotools.org";
final EmailAddress first = EmailAddress.fromString(text);
final EmailAddress second = EmailAddress.fromString(text);
final boolean actual = first.equals(second);
Assertions.assertTrue(actual);