Clarify how elements of arrays are compared by contentEquals function
Add clarification only for the particular group of overloads including arrays of object and floating point numbers. #KT-22942 Fixed
This commit is contained in:
@@ -97,6 +97,9 @@ public actual fun CharArray.asList(): List<Char> {
|
||||
*
|
||||
* If two corresponding elements are nested arrays, they are also compared deeply.
|
||||
* If any of arrays contains itself on any nesting level the behavior is undefined.
|
||||
*
|
||||
* The elements of other types are compared for equality with the [equals][Any.equals] function.
|
||||
* For floating point numbers it means that `NaN` is equal to itself and `-0.0` is not equal to `0.0`.
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
@library("arrayDeepEquals")
|
||||
@@ -134,6 +137,9 @@ public actual fun <T> Array<out T>.contentDeepToString(): String {
|
||||
/**
|
||||
* Returns `true` if the two specified arrays are *structurally* equal to one another,
|
||||
* i.e. contain the same number of the same elements in the same order.
|
||||
*
|
||||
* The elements are compared for equality with the [equals][Any.equals] function.
|
||||
* For floating point numbers it means that `NaN` is equal to itself and `-0.0` is not equal to `0.0`.
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
@library("arrayEquals")
|
||||
@@ -144,6 +150,9 @@ public actual infix fun <T> Array<out T>.contentEquals(other: Array<out T>): Boo
|
||||
/**
|
||||
* Returns `true` if the two specified arrays are *structurally* equal to one another,
|
||||
* i.e. contain the same number of the same elements in the same order.
|
||||
*
|
||||
* The elements are compared for equality with the [equals][Any.equals] function.
|
||||
* For floating point numbers it means that `NaN` is equal to itself and `-0.0` is not equal to `0.0`.
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
@library("arrayEquals")
|
||||
@@ -154,6 +163,9 @@ public actual infix fun ByteArray.contentEquals(other: ByteArray): Boolean {
|
||||
/**
|
||||
* Returns `true` if the two specified arrays are *structurally* equal to one another,
|
||||
* i.e. contain the same number of the same elements in the same order.
|
||||
*
|
||||
* The elements are compared for equality with the [equals][Any.equals] function.
|
||||
* For floating point numbers it means that `NaN` is equal to itself and `-0.0` is not equal to `0.0`.
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
@library("arrayEquals")
|
||||
@@ -164,6 +176,9 @@ public actual infix fun ShortArray.contentEquals(other: ShortArray): Boolean {
|
||||
/**
|
||||
* Returns `true` if the two specified arrays are *structurally* equal to one another,
|
||||
* i.e. contain the same number of the same elements in the same order.
|
||||
*
|
||||
* The elements are compared for equality with the [equals][Any.equals] function.
|
||||
* For floating point numbers it means that `NaN` is equal to itself and `-0.0` is not equal to `0.0`.
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
@library("arrayEquals")
|
||||
@@ -174,6 +189,9 @@ public actual infix fun IntArray.contentEquals(other: IntArray): Boolean {
|
||||
/**
|
||||
* Returns `true` if the two specified arrays are *structurally* equal to one another,
|
||||
* i.e. contain the same number of the same elements in the same order.
|
||||
*
|
||||
* The elements are compared for equality with the [equals][Any.equals] function.
|
||||
* For floating point numbers it means that `NaN` is equal to itself and `-0.0` is not equal to `0.0`.
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
@library("arrayEquals")
|
||||
@@ -184,6 +202,9 @@ public actual infix fun LongArray.contentEquals(other: LongArray): Boolean {
|
||||
/**
|
||||
* Returns `true` if the two specified arrays are *structurally* equal to one another,
|
||||
* i.e. contain the same number of the same elements in the same order.
|
||||
*
|
||||
* The elements are compared for equality with the [equals][Any.equals] function.
|
||||
* For floating point numbers it means that `NaN` is equal to itself and `-0.0` is not equal to `0.0`.
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
@library("arrayEquals")
|
||||
@@ -194,6 +215,9 @@ public actual infix fun FloatArray.contentEquals(other: FloatArray): Boolean {
|
||||
/**
|
||||
* Returns `true` if the two specified arrays are *structurally* equal to one another,
|
||||
* i.e. contain the same number of the same elements in the same order.
|
||||
*
|
||||
* The elements are compared for equality with the [equals][Any.equals] function.
|
||||
* For floating point numbers it means that `NaN` is equal to itself and `-0.0` is not equal to `0.0`.
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
@library("arrayEquals")
|
||||
@@ -204,6 +228,9 @@ public actual infix fun DoubleArray.contentEquals(other: DoubleArray): Boolean {
|
||||
/**
|
||||
* Returns `true` if the two specified arrays are *structurally* equal to one another,
|
||||
* i.e. contain the same number of the same elements in the same order.
|
||||
*
|
||||
* The elements are compared for equality with the [equals][Any.equals] function.
|
||||
* For floating point numbers it means that `NaN` is equal to itself and `-0.0` is not equal to `0.0`.
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
@library("arrayEquals")
|
||||
@@ -214,6 +241,9 @@ public actual infix fun BooleanArray.contentEquals(other: BooleanArray): Boolean
|
||||
/**
|
||||
* Returns `true` if the two specified arrays are *structurally* equal to one another,
|
||||
* i.e. contain the same number of the same elements in the same order.
|
||||
*
|
||||
* The elements are compared for equality with the [equals][Any.equals] function.
|
||||
* For floating point numbers it means that `NaN` is equal to itself and `-0.0` is not equal to `0.0`.
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
@library("arrayEquals")
|
||||
|
||||
Reference in New Issue
Block a user