Check Two Arrays are Deeply Equal

Java Array Examples


Java Arrays class provides deepEquals(Object[] a1, Object[] a2) method which returns true if the two specified arrays are deeply equal to one another.

Check Two Arrays are Deeply Equal Example

String[] strArray1 = { "abc", "cdf", "pqr" };
String[] strArray2 = { "abc", "cdf", "pqr" };
System.out.println("Two Arrays Deep Equals ::  " + Arrays.deepEquals(strArray1, strArray2));
Output:
Two Arrays Deep Equals ::  true

Reference



Comments