hashCode

Returns a hash code value for the object or zero if the object is null.

inline fun Any?.hashCode(): Int(source)
fun main() {
    val str: String? = "Kotlin"
    val nullable: String? = null

    println(str.hashCode())      // hash code of "Kotlin"
    println(nullable.hashCode()) // prints 0
}

Source