Similarly to the NotBlankString type, we would like to make the EmailAddress type comparable alphabetically by inheriting the Comparable interface.
interface EmailAddress : Comparable<EmailAddress> {
override fun compareTo(other: EmailAddress): Int
}
Here's an example of comparing two email addresses from Kotlin code:
val first = EmailAddress.create("first@kotools.org")
val second = EmailAddress.create("second@kotools.org")
println(first < second) // true
Here's an example of comparing two email addresses from Java code:
final EmailAddress first = EmailAddress.Companion.create("first@kotools.org");
final EmailAddress second = EmailAddress.Companion.create("second@kotools.org");
System.out.println(first < second); // true
✅ Checklist
[ ] Make the type comparable, test its compareTo function on Kotlin and Java, update the public API binaries and the unreleased changelog.
[ ] Close this issue as completed and update tracking ones if present.
📝 Description
Similarly to the
NotBlankString
type, we would like to make theEmailAddress
type comparable alphabetically by inheriting the Comparable interface.Here's an example of comparing two email addresses from Kotlin code:
Here's an example of comparing two email addresses from Java code:
✅ Checklist
compareTo
function on Kotlin and Java, update the public API binaries and the unreleased changelog.