Meaning of Objects.deepEquals method

The comparison would be deep, if you passed Array objects.

Non-array objects will not be evaluated deeper than what you get with equals .

So the depth isn't relevant in your case :

Two null values are deeply equal. If both arguments are arrays, the algorithm in Arrays.deepEquals is used to determine equality. Otherwise, equality is determined by using the equals method of the first argument.

Quoted from :

Object.deepEquals


You can refer: Your's Deeply - Why Arrays.deepEquals When We Have Arrays.equals

Arrays.deepEquals looks really deep

From the source, we could understand that Arrays.deepEquals

  1. Loops through the input arrays, gets each pair
  2. Analyses the type of each pair
  3. Delegates the equal deciding logic to one of the overloaded Arrays.equals if they are one of the primitive arrays
  4. Delegates recursively to Arrays.deepEquals if it is an Object array
  5. Calls the respective object’s equals, for any other object