From the Javadoc:
Two possibly null elements e1 and e2 are deeply equal if any of the following conditions hold:
- e1 and e2 are both arrays of object reference types, and Arrays.deepEquals(e1, e2) would return true
- e1 and e2 are arrays of the same primitive type, and the appropriate overloading of Arrays.equals(e1, e2) would return true.
- e1 == e2
- e1.equals(e2) would return true.
About the class of the objects you have in your arrays, make sure that overrides equals()
and hashcode()
properly.
UPDATE
Consult the Object javadoc, basically you need to add this to your class:
@Override
public boolean equals(Object other) {
// Add here code to verifiy that this object is "equals"
// to the method argument "other".
// return true if they are equal or false otherwise
}
@Override
public int hashCode() {
// Return here a "hash" integer (two objects equals to each other
// must return the same hashcode)
}