Udostępnij za pośrednictwem


Arrays.Mismatch Method

Definition

Overloads

Mismatch(Object[], Int32, Int32, Object[], Int32, Int32, IComparator)

Finds and returns the relative index of the first mismatch between two Object arrays over the specified ranges, otherwise return -1 if no mismatch is found.

Mismatch(Single[], Int32, Int32, Single[], Int32, Int32)

Finds and returns the relative index of the first mismatch between two float arrays over the specified ranges, otherwise return -1 if no mismatch is found.

Mismatch(Int64[], Int32, Int32, Int64[], Int32, Int32)

Finds and returns the relative index of the first mismatch between two long arrays over the specified ranges, otherwise return -1 if no mismatch is found.

Mismatch(Int32[], Int32, Int32, Int32[], Int32, Int32)

Finds and returns the relative index of the first mismatch between two int arrays over the specified ranges, otherwise return -1 if no mismatch is found.

Mismatch(Int16[], Int32, Int32, Int16[], Int32, Int32)

Finds and returns the relative index of the first mismatch between two short arrays over the specified ranges, otherwise return -1 if no mismatch is found.

Mismatch(Double[], Int32, Int32, Double[], Int32, Int32)

Finds and returns the relative index of the first mismatch between two double arrays over the specified ranges, otherwise return -1 if no mismatch is found.

Mismatch(Char[], Int32, Int32, Char[], Int32, Int32)

Finds and returns the relative index of the first mismatch between two char arrays over the specified ranges, otherwise return -1 if no mismatch is found.

Mismatch(Byte[], Int32, Int32, Byte[], Int32, Int32)

Finds and returns the relative index of the first mismatch between two byte arrays over the specified ranges, otherwise return -1 if no mismatch is found.

Mismatch(Boolean[], Int32, Int32, Boolean[], Int32, Int32)

Finds and returns the relative index of the first mismatch between two boolean arrays over the specified ranges, otherwise return -1 if no mismatch is found.

Mismatch(Object[], Int32, Int32, Object[], Int32, Int32)

Finds and returns the relative index of the first mismatch between two Object arrays over the specified ranges, otherwise return -1 if no mismatch is found.

Mismatch(Single[], Single[])

Finds and returns the index of the first mismatch between two float arrays, otherwise return -1 if no mismatch is found.

Mismatch(Int64[], Int64[])

Finds and returns the index of the first mismatch between two long arrays, otherwise return -1 if no mismatch is found.

Mismatch(Int32[], Int32[])

Finds and returns the index of the first mismatch between two int arrays, otherwise return -1 if no mismatch is found.

Mismatch(Int16[], Int16[])

Finds and returns the index of the first mismatch between two short arrays, otherwise return -1 if no mismatch is found.

Mismatch(Double[], Double[])

Finds and returns the index of the first mismatch between two double arrays, otherwise return -1 if no mismatch is found.

Mismatch(Char[], Char[])

Finds and returns the index of the first mismatch between two char arrays, otherwise return -1 if no mismatch is found.

Mismatch(Byte[], Byte[])

Finds and returns the index of the first mismatch between two byte arrays, otherwise return -1 if no mismatch is found.

Mismatch(Boolean[], Boolean[])

Finds and returns the index of the first mismatch between two boolean arrays, otherwise return -1 if no mismatch is found.

Mismatch(Object[], Object[])

Finds and returns the index of the first mismatch between two Object arrays, otherwise return -1 if no mismatch is found.

Mismatch(Object[], Object[], IComparator)

Finds and returns the index of the first mismatch between two Object arrays, otherwise return -1 if no mismatch is found.

Mismatch(Object[], Int32, Int32, Object[], Int32, Int32, IComparator)

Finds and returns the relative index of the first mismatch between two Object arrays over the specified ranges, otherwise return -1 if no mismatch is found.

[Android.Runtime.Register("mismatch", "([Ljava/lang/Object;II[Ljava/lang/Object;IILjava/util/Comparator;)I", "", ApiSince=33)]
[Java.Interop.JavaTypeParameters(new System.String[] { "T" })]
public static int Mismatch (Java.Lang.Object[] a, int aFromIndex, int aToIndex, Java.Lang.Object[] b, int bFromIndex, int bToIndex, Java.Util.IComparator cmp);
[<Android.Runtime.Register("mismatch", "([Ljava/lang/Object;II[Ljava/lang/Object;IILjava/util/Comparator;)I", "", ApiSince=33)>]
[<Java.Interop.JavaTypeParameters(new System.String[] { "T" })>]
static member Mismatch : Java.Lang.Object[] * int * int * Java.Lang.Object[] * int * int * Java.Util.IComparator -> int

Parameters

a
Object[]

the first array to be tested for a mismatch

aFromIndex
Int32

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

aToIndex
Int32

the index (exclusive) of the last element in the first array to be tested

b
Object[]

the second array to be tested for a mismatch

bFromIndex
Int32

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

bToIndex
Int32

the index (exclusive) of the last element in the second array to be tested

cmp
IComparator

the comparator to compare array elements

Returns

the relative index of the first mismatch between the two arrays over the specified ranges, otherwise -1.

Attributes

Remarks

Finds and returns the relative index of the first mismatch between two Object arrays over the specified ranges, otherwise return -1 if no mismatch is found. The index will be in the range of 0 (inclusive) up to the length (inclusive) of the smaller range.

If the two arrays, over the specified ranges, share a common prefix then the returned relative index is the length of the common prefix and it follows that there is a mismatch between the two elements at that relative index within the respective arrays. If one array is a proper prefix of the other, over the specified ranges, then the returned relative index is the length of the smaller range and it follows that the relative index is only valid for the array with the larger range. Otherwise, there is no mismatch.

Two non-null arrays, a and b with specified ranges [aFromIndex, atoIndex) and [bFromIndex, btoIndex) respectively, share a common prefix of length pl if the following expression is true:

{@code
                pl >= 0 &&
                pl < Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex) &&
                Arrays.equals(a, aFromIndex, aFromIndex + pl, b, bFromIndex, bFromIndex + pl, cmp) &&
                cmp.compare(a[aFromIndex + pl], b[bFromIndex + pl]) != 0
            }

Note that a common prefix length of 0 indicates that the first elements from each array mismatch.

Two non-null arrays, a and b with specified ranges [aFromIndex, atoIndex) and [bFromIndex, btoIndex) respectively, share a proper prefix if the following expression is true:

{@code
                (aToIndex - aFromIndex) != (bToIndex - bFromIndex) &&
                Arrays.equals(a, 0, Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex),
                              b, 0, Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex),
                              cmp)
            }

Added in 9.

Java documentation for java.util.Arrays.mismatch(T[], int, int, T[], int, int, java.util.Comparator<? super T>).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

Mismatch(Single[], Int32, Int32, Single[], Int32, Int32)

Finds and returns the relative index of the first mismatch between two float arrays over the specified ranges, otherwise return -1 if no mismatch is found.

[Android.Runtime.Register("mismatch", "([FII[FII)I", "", ApiSince=33)]
public static int Mismatch (float[] a, int aFromIndex, int aToIndex, float[] b, int bFromIndex, int bToIndex);
[<Android.Runtime.Register("mismatch", "([FII[FII)I", "", ApiSince=33)>]
static member Mismatch : single[] * int * int * single[] * int * int -> int

Parameters

a
Single[]

the first array to be tested for a mismatch

aFromIndex
Int32

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

aToIndex
Int32

the index (exclusive) of the last element in the first array to be tested

b
Single[]

the second array to be tested for a mismatch

bFromIndex
Int32

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

bToIndex
Int32

the index (exclusive) of the last element in the second array to be tested

Returns

the relative index of the first mismatch between the two arrays over the specified ranges, otherwise -1.

Attributes

Remarks

Finds and returns the relative index of the first mismatch between two float arrays over the specified ranges, otherwise return -1 if no mismatch is found. The index will be in the range of 0 (inclusive) up to the length (inclusive) of the smaller range.

If the two arrays, over the specified ranges, share a common prefix then the returned relative index is the length of the common prefix and it follows that there is a mismatch between the two elements at that relative index within the respective arrays. If one array is a proper prefix of the other, over the specified ranges, then the returned relative index is the length of the smaller range and it follows that the relative index is only valid for the array with the larger range. Otherwise, there is no mismatch.

Two non-null arrays, a and b with specified ranges [aFromIndex, atoIndex) and [bFromIndex, btoIndex) respectively, share a common prefix of length pl if the following expression is true:

{@code
                pl >= 0 &&
                pl < Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex) &&
                Arrays.equals(a, aFromIndex, aFromIndex + pl, b, bFromIndex, bFromIndex + pl) &&
                Float.compare(a[aFromIndex + pl], b[bFromIndex + pl]) != 0
            }

Note that a common prefix length of 0 indicates that the first elements from each array mismatch.

Two non-null arrays, a and b with specified ranges [aFromIndex, atoIndex) and [bFromIndex, btoIndex) respectively, share a proper prefix if the following expression is true:

{@code
                (aToIndex - aFromIndex) != (bToIndex - bFromIndex) &&
                Arrays.equals(a, 0, Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex),
                              b, 0, Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex))
            }

Added in 9.

Java documentation for java.util.Arrays.mismatch(float[], int, int, float[], int, int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

Mismatch(Int64[], Int32, Int32, Int64[], Int32, Int32)

Finds and returns the relative index of the first mismatch between two long arrays over the specified ranges, otherwise return -1 if no mismatch is found.

[Android.Runtime.Register("mismatch", "([JII[JII)I", "", ApiSince=33)]
public static int Mismatch (long[] a, int aFromIndex, int aToIndex, long[] b, int bFromIndex, int bToIndex);
[<Android.Runtime.Register("mismatch", "([JII[JII)I", "", ApiSince=33)>]
static member Mismatch : int64[] * int * int * int64[] * int * int -> int

Parameters

a
Int64[]

the first array to be tested for a mismatch

aFromIndex
Int32

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

aToIndex
Int32

the index (exclusive) of the last element in the first array to be tested

b
Int64[]

the second array to be tested for a mismatch

bFromIndex
Int32

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

bToIndex
Int32

the index (exclusive) of the last element in the second array to be tested

Returns

the relative index of the first mismatch between the two arrays over the specified ranges, otherwise -1.

Attributes

Remarks

Finds and returns the relative index of the first mismatch between two long arrays over the specified ranges, otherwise return -1 if no mismatch is found. The index will be in the range of 0 (inclusive) up to the length (inclusive) of the smaller range.

If the two arrays, over the specified ranges, share a common prefix then the returned relative index is the length of the common prefix and it follows that there is a mismatch between the two elements at that relative index within the respective arrays. If one array is a proper prefix of the other, over the specified ranges, then the returned relative index is the length of the smaller range and it follows that the relative index is only valid for the array with the larger range. Otherwise, there is no mismatch.

Two non-null arrays, a and b with specified ranges [aFromIndex, atoIndex) and [bFromIndex, btoIndex) respectively, share a common prefix of length pl if the following expression is true:

{@code
                pl >= 0 &&
                pl < Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex) &&
                Arrays.equals(a, aFromIndex, aFromIndex + pl, b, bFromIndex, bFromIndex + pl) &&
                a[aFromIndex + pl] != b[bFromIndex + pl]
            }

Note that a common prefix length of 0 indicates that the first elements from each array mismatch.

Two non-null arrays, a and b with specified ranges [aFromIndex, atoIndex) and [bFromIndex, btoIndex) respectively, share a proper prefix if the following expression is true:

{@code
                (aToIndex - aFromIndex) != (bToIndex - bFromIndex) &&
                Arrays.equals(a, 0, Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex),
                              b, 0, Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex))
            }

Added in 9.

Java documentation for java.util.Arrays.mismatch(long[], int, int, long[], int, int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

Mismatch(Int32[], Int32, Int32, Int32[], Int32, Int32)

Finds and returns the relative index of the first mismatch between two int arrays over the specified ranges, otherwise return -1 if no mismatch is found.

[Android.Runtime.Register("mismatch", "([III[III)I", "", ApiSince=33)]
public static int Mismatch (int[] a, int aFromIndex, int aToIndex, int[] b, int bFromIndex, int bToIndex);
[<Android.Runtime.Register("mismatch", "([III[III)I", "", ApiSince=33)>]
static member Mismatch : int[] * int * int * int[] * int * int -> int

Parameters

a
Int32[]

the first array to be tested for a mismatch

aFromIndex
Int32

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

aToIndex
Int32

the index (exclusive) of the last element in the first array to be tested

b
Int32[]

the second array to be tested for a mismatch

bFromIndex
Int32

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

bToIndex
Int32

the index (exclusive) of the last element in the second array to be tested

Returns

the relative index of the first mismatch between the two arrays over the specified ranges, otherwise -1.

Attributes

Remarks

Finds and returns the relative index of the first mismatch between two int arrays over the specified ranges, otherwise return -1 if no mismatch is found. The index will be in the range of 0 (inclusive) up to the length (inclusive) of the smaller range.

If the two arrays, over the specified ranges, share a common prefix then the returned relative index is the length of the common prefix and it follows that there is a mismatch between the two elements at that relative index within the respective arrays. If one array is a proper prefix of the other, over the specified ranges, then the returned relative index is the length of the smaller range and it follows that the relative index is only valid for the array with the larger range. Otherwise, there is no mismatch.

Two non-null arrays, a and b with specified ranges [aFromIndex, atoIndex) and [bFromIndex, btoIndex) respectively, share a common prefix of length pl if the following expression is true:

{@code
                pl >= 0 &&
                pl < Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex) &&
                Arrays.equals(a, aFromIndex, aFromIndex + pl, b, bFromIndex, bFromIndex + pl) &&
                a[aFromIndex + pl] != b[bFromIndex + pl]
            }

Note that a common prefix length of 0 indicates that the first elements from each array mismatch.

Two non-null arrays, a and b with specified ranges [aFromIndex, atoIndex) and [bFromIndex, btoIndex) respectively, share a proper prefix if the following expression is true:

{@code
                (aToIndex - aFromIndex) != (bToIndex - bFromIndex) &&
                Arrays.equals(a, 0, Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex),
                              b, 0, Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex))
            }

Added in 9.

Java documentation for java.util.Arrays.mismatch(int[], int, int, int[], int, int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

Mismatch(Int16[], Int32, Int32, Int16[], Int32, Int32)

Finds and returns the relative index of the first mismatch between two short arrays over the specified ranges, otherwise return -1 if no mismatch is found.

[Android.Runtime.Register("mismatch", "([SII[SII)I", "", ApiSince=33)]
public static int Mismatch (short[] a, int aFromIndex, int aToIndex, short[] b, int bFromIndex, int bToIndex);
[<Android.Runtime.Register("mismatch", "([SII[SII)I", "", ApiSince=33)>]
static member Mismatch : int16[] * int * int * int16[] * int * int -> int

Parameters

a
Int16[]

the first array to be tested for a mismatch

aFromIndex
Int32

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

aToIndex
Int32

the index (exclusive) of the last element in the first array to be tested

b
Int16[]

the second array to be tested for a mismatch

bFromIndex
Int32

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

bToIndex
Int32

the index (exclusive) of the last element in the second array to be tested

Returns

the relative index of the first mismatch between the two arrays over the specified ranges, otherwise -1.

Attributes

Remarks

Finds and returns the relative index of the first mismatch between two short arrays over the specified ranges, otherwise return -1 if no mismatch is found. The index will be in the range of 0 (inclusive) up to the length (inclusive) of the smaller range.

If the two arrays, over the specified ranges, share a common prefix then the returned relative index is the length of the common prefix and it follows that there is a mismatch between the two elements at that relative index within the respective arrays. If one array is a proper prefix of the other, over the specified ranges, then the returned relative index is the length of the smaller range and it follows that the relative index is only valid for the array with the larger range. Otherwise, there is no mismatch.

Two non-null arrays, a and b with specified ranges [aFromIndex, atoIndex) and [bFromIndex, btoIndex) respectively, share a common prefix of length pl if the following expression is true:

{@code
                pl >= 0 &&
                pl < Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex) &&
                Arrays.equals(a, aFromIndex, aFromIndex + pl, b, bFromIndex, bFromIndex + pl) &&
                a[aFromIndex + pl] != b[bFromIndex + pl]
            }

Note that a common prefix length of 0 indicates that the first elements from each array mismatch.

Two non-null arrays, a and b with specified ranges [aFromIndex, atoIndex) and [bFromIndex, btoIndex) respectively, share a proper prefix if the following expression is true:

{@code
                (aToIndex - aFromIndex) != (bToIndex - bFromIndex) &&
                Arrays.equals(a, 0, Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex),
                              b, 0, Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex))
            }

Added in 9.

Java documentation for java.util.Arrays.mismatch(short[], int, int, short[], int, int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

Mismatch(Double[], Int32, Int32, Double[], Int32, Int32)

Finds and returns the relative index of the first mismatch between two double arrays over the specified ranges, otherwise return -1 if no mismatch is found.

[Android.Runtime.Register("mismatch", "([DII[DII)I", "", ApiSince=33)]
public static int Mismatch (double[] a, int aFromIndex, int aToIndex, double[] b, int bFromIndex, int bToIndex);
[<Android.Runtime.Register("mismatch", "([DII[DII)I", "", ApiSince=33)>]
static member Mismatch : double[] * int * int * double[] * int * int -> int

Parameters

a
Double[]

the first array to be tested for a mismatch

aFromIndex
Int32

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

aToIndex
Int32

the index (exclusive) of the last element in the first array to be tested

b
Double[]

the second array to be tested for a mismatch

bFromIndex
Int32

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

bToIndex
Int32

the index (exclusive) of the last element in the second array to be tested

Returns

the relative index of the first mismatch between the two arrays over the specified ranges, otherwise -1.

Attributes

Remarks

Finds and returns the relative index of the first mismatch between two double arrays over the specified ranges, otherwise return -1 if no mismatch is found. The index will be in the range of 0 (inclusive) up to the length (inclusive) of the smaller range.

If the two arrays, over the specified ranges, share a common prefix then the returned relative index is the length of the common prefix and it follows that there is a mismatch between the two elements at that relative index within the respective arrays. If one array is a proper prefix of the other, over the specified ranges, then the returned relative index is the length of the smaller range and it follows that the relative index is only valid for the array with the larger range. Otherwise, there is no mismatch.

Two non-null arrays, a and b with specified ranges [aFromIndex, atoIndex) and [bFromIndex, btoIndex) respectively, share a common prefix of length pl if the following expression is true:

{@code
                pl >= 0 &&
                pl < Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex) &&
                Arrays.equals(a, aFromIndex, aFromIndex + pl, b, bFromIndex, bFromIndex + pl) &&
                Double.compare(a[aFromIndex + pl], b[bFromIndex + pl]) != 0
            }

Note that a common prefix length of 0 indicates that the first elements from each array mismatch.

Two non-null arrays, a and b with specified ranges [aFromIndex, atoIndex) and [bFromIndex, btoIndex) respectively, share a proper prefix if the following expression is true:

{@code
                (aToIndex - aFromIndex) != (bToIndex - bFromIndex) &&
                Arrays.equals(a, 0, Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex),
                              b, 0, Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex))
            }

Added in 9.

Java documentation for java.util.Arrays.mismatch(double[], int, int, double[], int, int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

Mismatch(Char[], Int32, Int32, Char[], Int32, Int32)

Finds and returns the relative index of the first mismatch between two char arrays over the specified ranges, otherwise return -1 if no mismatch is found.

[Android.Runtime.Register("mismatch", "([CII[CII)I", "", ApiSince=33)]
public static int Mismatch (char[] a, int aFromIndex, int aToIndex, char[] b, int bFromIndex, int bToIndex);
[<Android.Runtime.Register("mismatch", "([CII[CII)I", "", ApiSince=33)>]
static member Mismatch : char[] * int * int * char[] * int * int -> int

Parameters

a
Char[]

the first array to be tested for a mismatch

aFromIndex
Int32

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

aToIndex
Int32

the index (exclusive) of the last element in the first array to be tested

b
Char[]

the second array to be tested for a mismatch

bFromIndex
Int32

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

bToIndex
Int32

the index (exclusive) of the last element in the second array to be tested

Returns

the relative index of the first mismatch between the two arrays over the specified ranges, otherwise -1.

Attributes

Remarks

Finds and returns the relative index of the first mismatch between two char arrays over the specified ranges, otherwise return -1 if no mismatch is found. The index will be in the range of 0 (inclusive) up to the length (inclusive) of the smaller range.

If the two arrays, over the specified ranges, share a common prefix then the returned relative index is the length of the common prefix and it follows that there is a mismatch between the two elements at that relative index within the respective arrays. If one array is a proper prefix of the other, over the specified ranges, then the returned relative index is the length of the smaller range and it follows that the relative index is only valid for the array with the larger range. Otherwise, there is no mismatch.

Two non-null arrays, a and b with specified ranges [aFromIndex, atoIndex) and [bFromIndex, btoIndex) respectively, share a common prefix of length pl if the following expression is true:

{@code
                pl >= 0 &&
                pl < Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex) &&
                Arrays.equals(a, aFromIndex, aFromIndex + pl, b, bFromIndex, bFromIndex + pl) &&
                a[aFromIndex + pl] != b[bFromIndex + pl]
            }

Note that a common prefix length of 0 indicates that the first elements from each array mismatch.

Two non-null arrays, a and b with specified ranges [aFromIndex, atoIndex) and [bFromIndex, btoIndex) respectively, share a proper prefix if the following expression is true:

{@code
                (aToIndex - aFromIndex) != (bToIndex - bFromIndex) &&
                Arrays.equals(a, 0, Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex),
                              b, 0, Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex))
            }

Added in 9.

Java documentation for java.util.Arrays.mismatch(char[], int, int, char[], int, int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

Mismatch(Byte[], Int32, Int32, Byte[], Int32, Int32)

Finds and returns the relative index of the first mismatch between two byte arrays over the specified ranges, otherwise return -1 if no mismatch is found.

[Android.Runtime.Register("mismatch", "([BII[BII)I", "", ApiSince=33)]
public static int Mismatch (byte[]? a, int aFromIndex, int aToIndex, byte[]? b, int bFromIndex, int bToIndex);
[<Android.Runtime.Register("mismatch", "([BII[BII)I", "", ApiSince=33)>]
static member Mismatch : byte[] * int * int * byte[] * int * int -> int

Parameters

a
Byte[]

the first array to be tested for a mismatch

aFromIndex
Int32

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

aToIndex
Int32

the index (exclusive) of the last element in the first array to be tested

b
Byte[]

the second array to be tested for a mismatch

bFromIndex
Int32

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

bToIndex
Int32

the index (exclusive) of the last element in the second array to be tested

Returns

the relative index of the first mismatch between the two arrays over the specified ranges, otherwise -1.

Attributes

Remarks

Finds and returns the relative index of the first mismatch between two byte arrays over the specified ranges, otherwise return -1 if no mismatch is found. The index will be in the range of 0 (inclusive) up to the length (inclusive) of the smaller range.

If the two arrays, over the specified ranges, share a common prefix then the returned relative index is the length of the common prefix and it follows that there is a mismatch between the two elements at that relative index within the respective arrays. If one array is a proper prefix of the other, over the specified ranges, then the returned relative index is the length of the smaller range and it follows that the relative index is only valid for the array with the larger range. Otherwise, there is no mismatch.

Two non-null arrays, a and b with specified ranges [aFromIndex, atoIndex) and [bFromIndex, btoIndex) respectively, share a common prefix of length pl if the following expression is true:

{@code
                pl >= 0 &&
                pl < Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex) &&
                Arrays.equals(a, aFromIndex, aFromIndex + pl, b, bFromIndex, bFromIndex + pl) &&
                a[aFromIndex + pl] != b[bFromIndex + pl]
            }

Note that a common prefix length of 0 indicates that the first elements from each array mismatch.

Two non-null arrays, a and b with specified ranges [aFromIndex, atoIndex) and [bFromIndex, btoIndex) respectively, share a proper prefix if the following expression is true:

{@code
                (aToIndex - aFromIndex) != (bToIndex - bFromIndex) &&
                Arrays.equals(a, 0, Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex),
                              b, 0, Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex))
            }

Added in 9.

Java documentation for java.util.Arrays.mismatch(byte[], int, int, byte[], int, int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

Mismatch(Boolean[], Int32, Int32, Boolean[], Int32, Int32)

Finds and returns the relative index of the first mismatch between two boolean arrays over the specified ranges, otherwise return -1 if no mismatch is found.

[Android.Runtime.Register("mismatch", "([ZII[ZII)I", "", ApiSince=33)]
public static int Mismatch (bool[] a, int aFromIndex, int aToIndex, bool[] b, int bFromIndex, int bToIndex);
[<Android.Runtime.Register("mismatch", "([ZII[ZII)I", "", ApiSince=33)>]
static member Mismatch : bool[] * int * int * bool[] * int * int -> int

Parameters

a
Boolean[]

the first array to be tested for a mismatch

aFromIndex
Int32

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

aToIndex
Int32

the index (exclusive) of the last element in the first array to be tested

b
Boolean[]

the second array to be tested for a mismatch

bFromIndex
Int32

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

bToIndex
Int32

the index (exclusive) of the last element in the second array to be tested

Returns

the relative index of the first mismatch between the two arrays over the specified ranges, otherwise -1.

Attributes

Remarks

Finds and returns the relative index of the first mismatch between two boolean arrays over the specified ranges, otherwise return -1 if no mismatch is found. The index will be in the range of 0 (inclusive) up to the length (inclusive) of the smaller range.

If the two arrays, over the specified ranges, share a common prefix then the returned relative index is the length of the common prefix and it follows that there is a mismatch between the two elements at that relative index within the respective arrays. If one array is a proper prefix of the other, over the specified ranges, then the returned relative index is the length of the smaller range and it follows that the relative index is only valid for the array with the larger range. Otherwise, there is no mismatch.

Two non-null arrays, a and b with specified ranges [aFromIndex, atoIndex) and [bFromIndex, btoIndex) respectively, share a common prefix of length pl if the following expression is true:

{@code
                pl >= 0 &&
                pl < Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex) &&
                Arrays.equals(a, aFromIndex, aFromIndex + pl, b, bFromIndex, bFromIndex + pl) &&
                a[aFromIndex + pl] != b[bFromIndex + pl]
            }

Note that a common prefix length of 0 indicates that the first elements from each array mismatch.

Two non-null arrays, a and b with specified ranges [aFromIndex, atoIndex) and [bFromIndex, btoIndex) respectively, share a proper prefix if the following expression is true:

{@code
                (aToIndex - aFromIndex) != (bToIndex - bFromIndex) &&
                Arrays.equals(a, 0, Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex),
                              b, 0, Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex))
            }

Added in 9.

Java documentation for java.util.Arrays.mismatch(boolean[], int, int, boolean[], int, int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

Mismatch(Object[], Int32, Int32, Object[], Int32, Int32)

Finds and returns the relative index of the first mismatch between two Object arrays over the specified ranges, otherwise return -1 if no mismatch is found.

[Android.Runtime.Register("mismatch", "([Ljava/lang/Object;II[Ljava/lang/Object;II)I", "", ApiSince=33)]
public static int Mismatch (Java.Lang.Object[] a, int aFromIndex, int aToIndex, Java.Lang.Object[] b, int bFromIndex, int bToIndex);
[<Android.Runtime.Register("mismatch", "([Ljava/lang/Object;II[Ljava/lang/Object;II)I", "", ApiSince=33)>]
static member Mismatch : Java.Lang.Object[] * int * int * Java.Lang.Object[] * int * int -> int

Parameters

a
Object[]

the first array to be tested for a mismatch

aFromIndex
Int32

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

aToIndex
Int32

the index (exclusive) of the last element in the first array to be tested

b
Object[]

the second array to be tested for a mismatch

bFromIndex
Int32

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

bToIndex
Int32

the index (exclusive) of the last element in the second array to be tested

Returns

the relative index of the first mismatch between the two arrays over the specified ranges, otherwise -1.

Attributes

Remarks

Finds and returns the relative index of the first mismatch between two Object arrays over the specified ranges, otherwise return -1 if no mismatch is found. The index will be in the range of 0 (inclusive) up to the length (inclusive) of the smaller range.

If the two arrays, over the specified ranges, share a common prefix then the returned relative index is the length of the common prefix and it follows that there is a mismatch between the two elements at that relative index within the respective arrays. If one array is a proper prefix of the other, over the specified ranges, then the returned relative index is the length of the smaller range and it follows that the relative index is only valid for the array with the larger range. Otherwise, there is no mismatch.

Two non-null arrays, a and b with specified ranges [aFromIndex, atoIndex) and [bFromIndex, btoIndex) respectively, share a common prefix of length pl if the following expression is true:

{@code
                pl >= 0 &&
                pl < Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex) &&
                Arrays.equals(a, aFromIndex, aFromIndex + pl, b, bFromIndex, bFromIndex + pl) &&
                !Objects.equals(a[aFromIndex + pl], b[bFromIndex + pl])
            }

Note that a common prefix length of 0 indicates that the first elements from each array mismatch.

Two non-null arrays, a and b with specified ranges [aFromIndex, atoIndex) and [bFromIndex, btoIndex) respectively, share a proper prefix if the following expression is true:

{@code
                (aToIndex - aFromIndex) != (bToIndex - bFromIndex) &&
                Arrays.equals(a, 0, Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex),
                              b, 0, Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex))
            }

Added in 9.

Java documentation for java.util.Arrays.mismatch(java.lang.Object[], int, int, java.lang.Object[], int, int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

Mismatch(Single[], Single[])

Finds and returns the index of the first mismatch between two float arrays, otherwise return -1 if no mismatch is found.

[Android.Runtime.Register("mismatch", "([F[F)I", "", ApiSince=33)]
public static int Mismatch (float[] a, float[] b);
[<Android.Runtime.Register("mismatch", "([F[F)I", "", ApiSince=33)>]
static member Mismatch : single[] * single[] -> int

Parameters

a
Single[]

the first array to be tested for a mismatch

b
Single[]

the second array to be tested for a mismatch

Returns

the index of the first mismatch between the two arrays, otherwise -1.

Attributes

Remarks

Finds and returns the index of the first mismatch between two float arrays, otherwise return -1 if no mismatch is found. The index will be in the range of 0 (inclusive) up to the length (inclusive) of the smaller array.

If the two arrays share a common prefix then the returned index is the length of the common prefix and it follows that there is a mismatch between the two elements at that index within the respective arrays. If one array is a proper prefix of the other then the returned index is the length of the smaller array and it follows that the index is only valid for the larger array. Otherwise, there is no mismatch.

Two non-null arrays, a and b, share a common prefix of length pl if the following expression is true:

{@code
                pl >= 0 &&
                pl < Math.min(a.length, b.length) &&
                Arrays.equals(a, 0, pl, b, 0, pl) &&
                Float.compare(a[pl], b[pl]) != 0
            }

Note that a common prefix length of 0 indicates that the first elements from each array mismatch.

Two non-null arrays, a and b, share a proper prefix if the following expression is true:

{@code
                a.length != b.length &&
                Arrays.equals(a, 0, Math.min(a.length, b.length),
                              b, 0, Math.min(a.length, b.length))
            }

Added in 9.

Java documentation for java.util.Arrays.mismatch(float[], float[]).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

Mismatch(Int64[], Int64[])

Finds and returns the index of the first mismatch between two long arrays, otherwise return -1 if no mismatch is found.

[Android.Runtime.Register("mismatch", "([J[J)I", "", ApiSince=33)]
public static int Mismatch (long[] a, long[] b);
[<Android.Runtime.Register("mismatch", "([J[J)I", "", ApiSince=33)>]
static member Mismatch : int64[] * int64[] -> int

Parameters

a
Int64[]

the first array to be tested for a mismatch

b
Int64[]

the second array to be tested for a mismatch

Returns

the index of the first mismatch between the two arrays, otherwise -1.

Attributes

Remarks

Finds and returns the index of the first mismatch between two long arrays, otherwise return -1 if no mismatch is found. The index will be in the range of 0 (inclusive) up to the length (inclusive) of the smaller array.

If the two arrays share a common prefix then the returned index is the length of the common prefix and it follows that there is a mismatch between the two elements at that index within the respective arrays. If one array is a proper prefix of the other then the returned index is the length of the smaller array and it follows that the index is only valid for the larger array. Otherwise, there is no mismatch.

Two non-null arrays, a and b, share a common prefix of length pl if the following expression is true:

{@code
                pl >= 0 &&
                pl < Math.min(a.length, b.length) &&
                Arrays.equals(a, 0, pl, b, 0, pl) &&
                a[pl] != b[pl]
            }

Note that a common prefix length of 0 indicates that the first elements from each array mismatch.

Two non-null arrays, a and b, share a proper prefix if the following expression is true:

{@code
                a.length != b.length &&
                Arrays.equals(a, 0, Math.min(a.length, b.length),
                              b, 0, Math.min(a.length, b.length))
            }

Added in 9.

Java documentation for java.util.Arrays.mismatch(long[], long[]).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

Mismatch(Int32[], Int32[])

Finds and returns the index of the first mismatch between two int arrays, otherwise return -1 if no mismatch is found.

[Android.Runtime.Register("mismatch", "([I[I)I", "", ApiSince=33)]
public static int Mismatch (int[] a, int[] b);
[<Android.Runtime.Register("mismatch", "([I[I)I", "", ApiSince=33)>]
static member Mismatch : int[] * int[] -> int

Parameters

a
Int32[]

the first array to be tested for a mismatch

b
Int32[]

the second array to be tested for a mismatch

Returns

the index of the first mismatch between the two arrays, otherwise -1.

Attributes

Remarks

Finds and returns the index of the first mismatch between two int arrays, otherwise return -1 if no mismatch is found. The index will be in the range of 0 (inclusive) up to the length (inclusive) of the smaller array.

If the two arrays share a common prefix then the returned index is the length of the common prefix and it follows that there is a mismatch between the two elements at that index within the respective arrays. If one array is a proper prefix of the other then the returned index is the length of the smaller array and it follows that the index is only valid for the larger array. Otherwise, there is no mismatch.

Two non-null arrays, a and b, share a common prefix of length pl if the following expression is true:

{@code
                pl >= 0 &&
                pl < Math.min(a.length, b.length) &&
                Arrays.equals(a, 0, pl, b, 0, pl) &&
                a[pl] != b[pl]
            }

Note that a common prefix length of 0 indicates that the first elements from each array mismatch.

Two non-null arrays, a and b, share a proper prefix if the following expression is true:

{@code
                a.length != b.length &&
                Arrays.equals(a, 0, Math.min(a.length, b.length),
                              b, 0, Math.min(a.length, b.length))
            }

Added in 9.

Java documentation for java.util.Arrays.mismatch(int[], int[]).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

Mismatch(Int16[], Int16[])

Finds and returns the index of the first mismatch between two short arrays, otherwise return -1 if no mismatch is found.

[Android.Runtime.Register("mismatch", "([S[S)I", "", ApiSince=33)]
public static int Mismatch (short[] a, short[] b);
[<Android.Runtime.Register("mismatch", "([S[S)I", "", ApiSince=33)>]
static member Mismatch : int16[] * int16[] -> int

Parameters

a
Int16[]

the first array to be tested for a mismatch

b
Int16[]

the second array to be tested for a mismatch

Returns

the index of the first mismatch between the two arrays, otherwise -1.

Attributes

Remarks

Finds and returns the index of the first mismatch between two short arrays, otherwise return -1 if no mismatch is found. The index will be in the range of 0 (inclusive) up to the length (inclusive) of the smaller array.

If the two arrays share a common prefix then the returned index is the length of the common prefix and it follows that there is a mismatch between the two elements at that index within the respective arrays. If one array is a proper prefix of the other then the returned index is the length of the smaller array and it follows that the index is only valid for the larger array. Otherwise, there is no mismatch.

Two non-null arrays, a and b, share a common prefix of length pl if the following expression is true:

{@code
                pl >= 0 &&
                pl < Math.min(a.length, b.length) &&
                Arrays.equals(a, 0, pl, b, 0, pl) &&
                a[pl] != b[pl]
            }

Note that a common prefix length of 0 indicates that the first elements from each array mismatch.

Two non-null arrays, a and b, share a proper prefix if the following expression is true:

{@code
                a.length != b.length &&
                Arrays.equals(a, 0, Math.min(a.length, b.length),
                              b, 0, Math.min(a.length, b.length))
            }

Added in 9.

Java documentation for java.util.Arrays.mismatch(short[], short[]).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

Mismatch(Double[], Double[])

Finds and returns the index of the first mismatch between two double arrays, otherwise return -1 if no mismatch is found.

[Android.Runtime.Register("mismatch", "([D[D)I", "", ApiSince=33)]
public static int Mismatch (double[] a, double[] b);
[<Android.Runtime.Register("mismatch", "([D[D)I", "", ApiSince=33)>]
static member Mismatch : double[] * double[] -> int

Parameters

a
Double[]

the first array to be tested for a mismatch

b
Double[]

the second array to be tested for a mismatch

Returns

the index of the first mismatch between the two arrays, otherwise -1.

Attributes

Remarks

Finds and returns the index of the first mismatch between two double arrays, otherwise return -1 if no mismatch is found. The index will be in the range of 0 (inclusive) up to the length (inclusive) of the smaller array.

If the two arrays share a common prefix then the returned index is the length of the common prefix and it follows that there is a mismatch between the two elements at that index within the respective arrays. If one array is a proper prefix of the other then the returned index is the length of the smaller array and it follows that the index is only valid for the larger array. Otherwise, there is no mismatch.

Two non-null arrays, a and b, share a common prefix of length pl if the following expression is true:

{@code
                pl >= 0 &&
                pl < Math.min(a.length, b.length) &&
                Arrays.equals(a, 0, pl, b, 0, pl) &&
                Double.compare(a[pl], b[pl]) != 0
            }

Note that a common prefix length of 0 indicates that the first elements from each array mismatch.

Two non-null arrays, a and b, share a proper prefix if the following expression is true:

{@code
                a.length != b.length &&
                Arrays.equals(a, 0, Math.min(a.length, b.length),
                              b, 0, Math.min(a.length, b.length))
            }

Added in 9.

Java documentation for java.util.Arrays.mismatch(double[], double[]).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

Mismatch(Char[], Char[])

Finds and returns the index of the first mismatch between two char arrays, otherwise return -1 if no mismatch is found.

[Android.Runtime.Register("mismatch", "([C[C)I", "", ApiSince=33)]
public static int Mismatch (char[] a, char[] b);
[<Android.Runtime.Register("mismatch", "([C[C)I", "", ApiSince=33)>]
static member Mismatch : char[] * char[] -> int

Parameters

a
Char[]

the first array to be tested for a mismatch

b
Char[]

the second array to be tested for a mismatch

Returns

the index of the first mismatch between the two arrays, otherwise -1.

Attributes

Remarks

Finds and returns the index of the first mismatch between two char arrays, otherwise return -1 if no mismatch is found. The index will be in the range of 0 (inclusive) up to the length (inclusive) of the smaller array.

If the two arrays share a common prefix then the returned index is the length of the common prefix and it follows that there is a mismatch between the two elements at that index within the respective arrays. If one array is a proper prefix of the other then the returned index is the length of the smaller array and it follows that the index is only valid for the larger array. Otherwise, there is no mismatch.

Two non-null arrays, a and b, share a common prefix of length pl if the following expression is true:

{@code
                pl >= 0 &&
                pl < Math.min(a.length, b.length) &&
                Arrays.equals(a, 0, pl, b, 0, pl) &&
                a[pl] != b[pl]
            }

Note that a common prefix length of 0 indicates that the first elements from each array mismatch.

Two non-null arrays, a and b, share a proper prefix if the following expression is true:

{@code
                a.length != b.length &&
                Arrays.equals(a, 0, Math.min(a.length, b.length),
                              b, 0, Math.min(a.length, b.length))
            }

Added in 9.

Java documentation for java.util.Arrays.mismatch(char[], char[]).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

Mismatch(Byte[], Byte[])

Finds and returns the index of the first mismatch between two byte arrays, otherwise return -1 if no mismatch is found.

[Android.Runtime.Register("mismatch", "([B[B)I", "", ApiSince=33)]
public static int Mismatch (byte[] a, byte[] b);
[<Android.Runtime.Register("mismatch", "([B[B)I", "", ApiSince=33)>]
static member Mismatch : byte[] * byte[] -> int

Parameters

a
Byte[]

the first array to be tested for a mismatch

b
Byte[]

the second array to be tested for a mismatch

Returns

the index of the first mismatch between the two arrays, otherwise -1.

Attributes

Remarks

Finds and returns the index of the first mismatch between two byte arrays, otherwise return -1 if no mismatch is found. The index will be in the range of 0 (inclusive) up to the length (inclusive) of the smaller array.

If the two arrays share a common prefix then the returned index is the length of the common prefix and it follows that there is a mismatch between the two elements at that index within the respective arrays. If one array is a proper prefix of the other then the returned index is the length of the smaller array and it follows that the index is only valid for the larger array. Otherwise, there is no mismatch.

Two non-null arrays, a and b, share a common prefix of length pl if the following expression is true:

{@code
                pl >= 0 &&
                pl < Math.min(a.length, b.length) &&
                Arrays.equals(a, 0, pl, b, 0, pl) &&
                a[pl] != b[pl]
            }

Note that a common prefix length of 0 indicates that the first elements from each array mismatch.

Two non-null arrays, a and b, share a proper prefix if the following expression is true:

{@code
                a.length != b.length &&
                Arrays.equals(a, 0, Math.min(a.length, b.length),
                              b, 0, Math.min(a.length, b.length))
            }

Added in 9.

Java documentation for java.util.Arrays.mismatch(byte[], byte[]).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

Mismatch(Boolean[], Boolean[])

Finds and returns the index of the first mismatch between two boolean arrays, otherwise return -1 if no mismatch is found.

[Android.Runtime.Register("mismatch", "([Z[Z)I", "", ApiSince=33)]
public static int Mismatch (bool[] a, bool[] b);
[<Android.Runtime.Register("mismatch", "([Z[Z)I", "", ApiSince=33)>]
static member Mismatch : bool[] * bool[] -> int

Parameters

a
Boolean[]

the first array to be tested for a mismatch

b
Boolean[]

the second array to be tested for a mismatch

Returns

the index of the first mismatch between the two arrays, otherwise -1.

Attributes

Remarks

Finds and returns the index of the first mismatch between two boolean arrays, otherwise return -1 if no mismatch is found. The index will be in the range of 0 (inclusive) up to the length (inclusive) of the smaller array.

If the two arrays share a common prefix then the returned index is the length of the common prefix and it follows that there is a mismatch between the two elements at that index within the respective arrays. If one array is a proper prefix of the other then the returned index is the length of the smaller array and it follows that the index is only valid for the larger array. Otherwise, there is no mismatch.

Two non-null arrays, a and b, share a common prefix of length pl if the following expression is true:

{@code
                pl >= 0 &&
                pl < Math.min(a.length, b.length) &&
                Arrays.equals(a, 0, pl, b, 0, pl) &&
                a[pl] != b[pl]
            }

Note that a common prefix length of 0 indicates that the first elements from each array mismatch.

Two non-null arrays, a and b, share a proper prefix if the following expression is true:

{@code
                a.length != b.length &&
                Arrays.equals(a, 0, Math.min(a.length, b.length),
                              b, 0, Math.min(a.length, b.length))
            }

Added in 9.

Java documentation for java.util.Arrays.mismatch(boolean[], boolean[]).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

Mismatch(Object[], Object[])

Finds and returns the index of the first mismatch between two Object arrays, otherwise return -1 if no mismatch is found.

[Android.Runtime.Register("mismatch", "([Ljava/lang/Object;[Ljava/lang/Object;)I", "", ApiSince=33)]
public static int Mismatch (Java.Lang.Object[] a, Java.Lang.Object[] b);
[<Android.Runtime.Register("mismatch", "([Ljava/lang/Object;[Ljava/lang/Object;)I", "", ApiSince=33)>]
static member Mismatch : Java.Lang.Object[] * Java.Lang.Object[] -> int

Parameters

a
Object[]

the first array to be tested for a mismatch

b
Object[]

the second array to be tested for a mismatch

Returns

the index of the first mismatch between the two arrays, otherwise -1.

Attributes

Remarks

Finds and returns the index of the first mismatch between two Object arrays, otherwise return -1 if no mismatch is found. The index will be in the range of 0 (inclusive) up to the length (inclusive) of the smaller array.

If the two arrays share a common prefix then the returned index is the length of the common prefix and it follows that there is a mismatch between the two elements at that index within the respective arrays. If one array is a proper prefix of the other then the returned index is the length of the smaller array and it follows that the index is only valid for the larger array. Otherwise, there is no mismatch.

Two non-null arrays, a and b, share a common prefix of length pl if the following expression is true:

{@code
                pl >= 0 &&
                pl < Math.min(a.length, b.length) &&
                Arrays.equals(a, 0, pl, b, 0, pl) &&
                !Objects.equals(a[pl], b[pl])
            }

Note that a common prefix length of 0 indicates that the first elements from each array mismatch.

Two non-null arrays, a and b, share a proper prefix if the following expression is true:

{@code
                a.length != b.length &&
                Arrays.equals(a, 0, Math.min(a.length, b.length),
                              b, 0, Math.min(a.length, b.length))
            }

Added in 9.

Java documentation for java.util.Arrays.mismatch(java.lang.Object[], java.lang.Object[]).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

Mismatch(Object[], Object[], IComparator)

Finds and returns the index of the first mismatch between two Object arrays, otherwise return -1 if no mismatch is found.

[Android.Runtime.Register("mismatch", "([Ljava/lang/Object;[Ljava/lang/Object;Ljava/util/Comparator;)I", "", ApiSince=33)]
[Java.Interop.JavaTypeParameters(new System.String[] { "T" })]
public static int Mismatch (Java.Lang.Object[] a, Java.Lang.Object[] b, Java.Util.IComparator cmp);
[<Android.Runtime.Register("mismatch", "([Ljava/lang/Object;[Ljava/lang/Object;Ljava/util/Comparator;)I", "", ApiSince=33)>]
[<Java.Interop.JavaTypeParameters(new System.String[] { "T" })>]
static member Mismatch : Java.Lang.Object[] * Java.Lang.Object[] * Java.Util.IComparator -> int

Parameters

a
Object[]

the first array to be tested for a mismatch

b
Object[]

the second array to be tested for a mismatch

cmp
IComparator

the comparator to compare array elements

Returns

the index of the first mismatch between the two arrays, otherwise -1.

Attributes

Remarks

Finds and returns the index of the first mismatch between two Object arrays, otherwise return -1 if no mismatch is found. The index will be in the range of 0 (inclusive) up to the length (inclusive) of the smaller array.

The specified comparator is used to determine if two array elements from the each array are not equal.

If the two arrays share a common prefix then the returned index is the length of the common prefix and it follows that there is a mismatch between the two elements at that index within the respective arrays. If one array is a proper prefix of the other then the returned index is the length of the smaller array and it follows that the index is only valid for the larger array. Otherwise, there is no mismatch.

Two non-null arrays, a and b, share a common prefix of length pl if the following expression is true:

{@code
                pl >= 0 &&
                pl < Math.min(a.length, b.length) &&
                Arrays.equals(a, 0, pl, b, 0, pl, cmp)
                cmp.compare(a[pl], b[pl]) != 0
            }

Note that a common prefix length of 0 indicates that the first elements from each array mismatch.

Two non-null arrays, a and b, share a proper prefix if the following expression is true:

{@code
                a.length != b.length &&
                Arrays.equals(a, 0, Math.min(a.length, b.length),
                              b, 0, Math.min(a.length, b.length),
                              cmp)
            }

Added in 9.

Java documentation for java.util.Arrays.mismatch(T[], T[], java.util.Comparator<? super T>).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to