Partager via


Arrays.DeepEquals(Object[], Object[]) Method

Definition

Returns true if the two specified arrays are deeply equal to one another.

[Android.Runtime.Register("deepEquals", "([Ljava/lang/Object;[Ljava/lang/Object;)Z", "")]
public static bool DeepEquals (Java.Lang.Object[]? a1, Java.Lang.Object[]? a2);
[<Android.Runtime.Register("deepEquals", "([Ljava/lang/Object;[Ljava/lang/Object;)Z", "")>]
static member DeepEquals : Java.Lang.Object[] * Java.Lang.Object[] -> bool

Parameters

a1
Object[]

one array to be tested for equality

a2
Object[]

the other array to be tested for equality

Returns

true if the two arrays are equal

Attributes

Remarks

Returns true if the two specified arrays are deeply equal to one another. Unlike the #equals(Object[],Object[]) method, this method is appropriate for use with nested arrays of arbitrary depth.

Two array references are considered deeply equal if both are null, or if they refer to arrays that contain the same number of elements and all corresponding pairs of elements in the two arrays are deeply equal.

Two possibly null elements e1 and e2 are deeply equal if any of the following conditions hold: <ul> <li> e1 and e2 are both arrays of object reference types, and Arrays.deepEquals(e1, e2) would return true<li> e1 and e2 are arrays of the same primitive type, and the appropriate overloading of Arrays.equals(e1, e2) would return true. <li> e1 == e2<li> e1.equals(e2) would return true. </ul> Note that this definition permits null elements at any depth.

If either of the specified arrays contain themselves as elements either directly or indirectly through one or more levels of arrays, the behavior of this method is undefined.

Added in 1.5.

Java documentation for java.util.Arrays.deepEquals(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