Effective Kotlin: Item 14 —Consider implementing Comparable

Kotlin is no exception when it comes to the advantages of implementing the Comparable interface as Joshua Bloch discusses in item 14 of Effective Java.

With Kotlin we should implement kotlin.Comparable rather than java.util.Comparable. Both require the implementation of a compareTo function, but, using Kotlin’s version gives access to some extension functions. The below code shows an example compareTo function using Java 8’s comparingInt, available since Android API 24.

class Date(val year: Int, val