boolean (@NotNull ComparableObject me, Object him) { if (me == him) { return true; } else if (!(him instanceof ComparableObject)) { return false; } Object[] my = me.getEqualityObjects(); Object[] his = ((ComparableObject) him).getEqualityObjects(); if (his.length == 0) { return false; } return ArrayUtil.areEqual(my, his, Comparing::equal); }