mismatch

fun mismatch(a: LongArray, aFromIndex: Int, b: LongArray, bFromIndex: Int, length: Int): Int

Returns the index of the first element that differs between the two LongArrays, starting at aFromIndex in a and bFromIndex in b, for up to length elements.

If no mismatch is found in the given range, returns -1.


fun mismatch(a: FloatArray, aFromIndex: Int, b: FloatArray, bFromIndex: Int, length: Int): Int
fun mismatch(a: CharArray, aFromIndex: Int, b: CharArray, bFromIndex: Int, length: Int): Int


fun mismatch(a: IntArray, aFromIndex: Int, b: IntArray, bFromIndex: Int, length: Int): Int

Returns the relative index of the first mismatch between two subranges of the given arrays, or -1 if there is no mismatch.

This function compares up to length elements from a starting at aFromIndex and from b starting at bFromIndex.


fun mismatch(a: ByteArray, aFromIndex: Int, b: ByteArray, bFromIndex: Int, length: Int): Int

Finds the relative index of a mismatch between two arrays starting from the given indexes.

This method does not perform bounds checks. It is the responsibility of the caller to ensure that the indexes and length are valid.

Return

the relative index of a mismatch between the two arrays, or -1 if no mismatch is found.

Parameters

a

the first array to be tested for a mismatch

aFromIndex

the index of the first element (inclusive) in the first array to be compared

b

the second array to be tested for a mismatch

bFromIndex

the index of the first element (inclusive) in the second array to be compared

length

the number of bytes from each array to check