Source:
<code>private static boolean valueEquals(@Nullable Object value1, @Nullable Object value2) { if ((value1 == null) && (value2 == null)) { return true; } if ((value1 == null) || (value2 == null)) { return false; } Class<?> class1 = value1.getClass(); <START> Class<?> class2 = value2.getClass(); <END> if (class1.isArray() && class2.isArray()) { if (class1.equals(int[].class) && class2.equals(int[].class)) { return Arrays.equals((int[]) value1, (int[]) value2); } else if (class1.equals(float[].class) && class2.equals(float[].class)) { return Arrays.equals((float[]) value1, (float[]) value2); } else if (class1.equals(double[].class) && class2.equals(double[].class)) { return Arrays.equals((double[]) value1, (double[]) value2); } else if (class1.equals(boolean[].class) && class2.equals(boolean[].class)) { return Arrays.equals((boolean[]) value1, (boolean[]) value2); } else if (class1.equals(byte[].class) && class2.equals(byte[].class)) { return Arrays.equals((byte[]) value1, (byte[]) value2); } else if (class1.equals(short[].class) && class2.equals(short[].class)) { return Arrays.equals((short[]) value1, (short[]) value2); } else if (class1.equals(long[].class) && class2.equals(long[].class)) { return Arrays.equals((long[]) value1, (long[]) value2); } else if (class1.equals(char[].class) && class2.equals(char[].class)) { return Arrays.equals((char[]) value1, (char[]) value2); } else if (class1.equals(Object[].class) && class2.equals(Object[].class)) { return Arrays.equals((Object[]) value1, (Object[]) value2); } return false; } return (value1.equals(value2)); }</code><technical_language>exit early if classes different? avoid checks of class2 below</technical_language>

Target:
private static boolean valueEquals(@Nullable Object value1, @Nullable Object value2) { if ((value1 == null) && (value2 == null)) { return true; } if ((value1 == null) || (value2 == null)) { return false; } Class<?> class1 = value1.getClass(); Class<?> class2 = value2.getClass(); if (class1.isArray() && class2.isArray() && class1.equals(class2)) { if (class1.equals(int[].class) && class2.equals(int[].class)) { return Arrays.equals((int[]) value1, (int[]) value2); } else if (class1.equals(float[].class) && class2.equals(float[].class)) { return Arrays.equals((float[]) value1, (float[]) value2); } else if (class1.equals(double[].class) && class2.equals(double[].class)) { return Arrays.equals((double[]) value1, (double[]) value2); } else if (class1.equals(boolean[].class) && class2.equals(boolean[].class)) { return Arrays.equals((boolean[]) value1, (boolean[]) value2); } else if (class1.equals(byte[].class) && class2.equals(byte[].class)) { return Arrays.equals((byte[]) value1, (byte[]) value2); } else if (class1.equals(short[].class) && class2.equals(short[].class)) { return Arrays.equals((short[]) value1, (short[]) value2); } else if (class1.equals(long[].class) && class2.equals(long[].class)) { return Arrays.equals((long[]) value1, (long[]) value2); } else if (class1.equals(char[].class) && class2.equals(char[].class)) { return Arrays.equals((char[]) value1, (char[]) value2); } else if (class1.equals(Object[].class) && class2.equals(Object[].class)) { return Arrays.equals((Object[]) value1, (Object[]) value2); } return false; } return (value1.equals(value2)); }