I have two instances of the same class:
Object instance1;
Object instance2;
I know that the class in question has an array field. I need to compare the identityHashCode of the array field, and in some cases I expect it to be the same.
The thing is that they are always different. I am guessing that is to be expected since they are in effect two different instances.
Is there a way to compare two arrays disregarding what elements they hold?
I am using Java reflection to get the value of the arrays.
Sure, you could compare the component type and the size: