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
obj.getClass().isArray()
I'm afraid the only alternative would be to use reflection, which would be nearly as ugly.
Arrays.getClass() .getMethod("equals", new Class[]{obj1.getClass(), obj2.getClass()}) .invoke(null, new object[]{obj1, obj2});
Not tested, could fail in all kinds of ways, needs lots of exception handling...