Here you can find the source of deepEquals(Object[] a1, Object[] a2)
Arrays.deepEquals
.
private static boolean deepEquals(Object[] a1, Object[] a2)
//package com.java2s; // Metawidget (licensed under LGPL) public class Main { /**/*from w ww . j a va 2 s . c om*/ * Copied from <code>Arrays.deepEquals</code>. <code>Arrays.deepEquals</code> not supported by * GWT 1.7. */ private static boolean deepEquals(Object[] a1, Object[] a2) { if (a1 == a2) { return true; } if (a1 == null || a2 == null) { return false; } int length = a1.length; if (a2.length != length) { return false; } for (int i = 0; i < length; i++) { Object e1 = a1[i]; Object e2 = a2[i]; if (e1 == e2) { continue; } if (e1 == null) { return false; } // Figure out whether the two elements are equal boolean eq; if (e1 instanceof Object[] && e2 instanceof Object[]) { eq = deepEquals((Object[]) e1, (Object[]) e2); } else { eq = e1.equals(e2); } if (!eq) { return false; } } return true; } }