O'Reilly logo
  • MICHAEL MASLENKO thinks this is interesting:

One common pattern of using a safe cast is combining it with the Elvis operator. For example, this comes in handy for implementing the equals method


Cover of Kotlin in Action


7 R+
val otherPerson = o as? Person ?: return false