W3cubDocs

/Kotlin

equals

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

Compares this list with another list instance with the ordered structural equality.

Return true, if other instance is a List of the same size, which contains the same elements in the same order.

For Native

Indicates whether some other object is "equal to" this one. Implementations must fulfil the following requirements:

  • Reflexive: for any non-null value x, x.equals(x) should return true.
  • Symmetric: for any non-null values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • Transitive: for any non-null values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • Consistent: for any non-null values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • Never equal to null: for any non-null value x, x.equals(null) should return false.

Read more about equality in Kotlin.

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