Search⌘ K
AI Features

Equality and Identity

Explore Kotlin's approach to equality and identity, learning to use the == operator for safe structural equality checks and === for reference identity. Understand the differences from Java and how Kotlin's design enhances code safety and readability.

We'll cover the following...

Equality

Kotlin internally converts == to the call of equals.

This means, that in Kotlin, we check instances with == for structural equality instead of identity, like in Java.

As a consequence, we ...