W3cubDocs

/Kotlin

equals

Platform and version requirements: JVM (1.0), JS (1.1), Native (1.3)
abstract fun equals(other: Any?): Boolean
For JVM

Returns true if this KClass instance represents the same Kotlin class as the class represented by other. On JVM this means that all of the following conditions are satisfied:

  1. other has the same (fully qualified) Kotlin class name as this instance.
  2. other's backing Class object is loaded with the same class loader as the Class object of this instance.
  3. If the classes represent Array, then Class objects of their element types are equal.

For example, on JVM, KClass instances for a primitive type (int) and the corresponding wrapper type (java.lang.Integer) are considered equal, because they have the same fully qualified name "kotlin.Int".

For JS, Native

Returns true if this KClass instance represents the same Kotlin class as the class represented by other. On JVM this means that all of the following conditions are satisfied:

  1. other has the same (fully qualified) Kotlin class name as this instance.
  2. other's backing Class object is loaded with the same class loader as the Class object of this instance.
  3. If the classes represent Array, then Class objects of their element types are equal.

For example, on JVM, KClass instances for a primitive type (int) and the corresponding wrapper type (java.lang.Integer) are considered equal, because they have the same fully qualified name "kotlin.Int".

© 2010–2019 JetBrains s.r.o.
Licensed under the Apache License, Version 2.0.
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.reflect/-k-class/equals.html