equals

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

Returns true if the other object is an EmailAddress having 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 first: EmailAddress = EmailAddress.create("[email protected]")
val second: EmailAddress = EmailAddress.create("$first")
val result: Boolean = first == second // or first.equals(second)
println(result) // true

Calling from Java

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

final String text = "[email protected]";
final EmailAddress first = EmailAddress.Companion.create(text);
final EmailAddress second = EmailAddress.Companion.create(text);
final boolean result = first.equals(second);
System.out.println(result); // true