Working within Java, let\'s say I have two objects that, thanks to obj.getClass().isArray(), I know are both arrays. Let\'s further say that I want to compare
// Test if both arrays are of the same type
if (array1.class.getComponentType.equals(array2.class.getComponentTYpe)) {
// Polymorphism FTW !
return Arrays.equals(array1, array2);
}