@Test public void testCompare() { assertTrue(Args.compare(ArrayUtils.EMPTY_CLASS_ARRAY, ArrayUtils.EMPTY_CLASS_ARRAY) == 0); assertTrue(Args.compare(ArrayUtils.EMPTY_CLASS_ARRAY, new Class[] { String.class }) < 0); assertTrue(Args.compare(new Class[] { String.class }, ArrayUtils.EMPTY_CLASS_ARRAY) > 0); assertTrue(Args.compare(new Class[] { String.class }, new Class[] { String.class }) == 0); assertTrue(Args.compare(new Class[] { int.class }, new Class[] { String.class }) < 0); assertTrue(Args.compare(new Class[] { String.class }, new Class[] { int.class }) > 0); assertTrue(Args.compare(new Class[] { int.class, String.class }, new Class[] { int.class, String.class}) == 0); assertTrue(Args.compare(new Class[] { String.class, String.class }, new Class[] { String.class, String.class}) == 0); assertTrue(Args.compare(new Class[] { String.class, int.class }, new Class[] { String.class, String.class}) < 0); assertTrue(Args.compare(new Class[] { String.class, String.class }, new Class[] { String.class, int.class}) > 0); }
@SuppressWarnings("PMD.UseVarargs") public static int compare(final Class<?>[] paramTypes1, final Class<?>[] paramTypes2) { for (int param = 0; param < paramTypes1.length; param++) { if (param >= paramTypes2.length) { return 1; } final int test = paramTypes1[param].getName().compareTo(paramTypes2[param].getName()); if (test == 0) { continue; } return test; } if (paramTypes1.length == paramTypes2.length) { return 0; } return -1; }
Args { @SuppressWarnings("PMD.UseVarargs") public static int compare(final Class<?>[] paramTypes1, final Class<?>[] paramTypes2) { for (int param = 0; param < paramTypes1.length; param++) { if (param >= paramTypes2.length) { return 1; } final int test = paramTypes1[param].getName().compareTo(paramTypes2[param].getName()); if (test == 0) { continue; } return test; } if (paramTypes1.length == paramTypes2.length) { return 0; } return -1; } }
Args { @SuppressWarnings("PMD.UseVarargs") public static int compare(final Class<?>[] paramTypes1, final Class<?>[] paramTypes2) { for (int param = 0; param < paramTypes1.length; param++) { if (param >= paramTypes2.length) { return 1; } final int test = paramTypes1[param].getName().compareTo(paramTypes2[param].getName()); if (test == 0) { continue; } return test; } if (paramTypes1.length == paramTypes2.length) { return 0; } return -1; } private  Args(); }
Args { @SuppressWarnings("PMD.UseVarargs") public static int compare(final Class<?>[] paramTypes1, final Class<?>[] paramTypes2) { for (int param = 0; param < paramTypes1.length; param++) { if (param >= paramTypes2.length) { return 1; } final int test = paramTypes1[param].getName().compareTo(paramTypes2[param].getName()); if (test == 0) { continue; } return test; } if (paramTypes1.length == paramTypes2.length) { return 0; } return -1; } private  Args(); @SuppressWarnings("PMD.UseVarargs") // not needed for comparing one array to another static int compare(final Class<?>[] paramTypes1, final Class<?>[] paramTypes2); }
Args { @SuppressWarnings("PMD.UseVarargs") public static int compare(final Class<?>[] paramTypes1, final Class<?>[] paramTypes2) { for (int param = 0; param < paramTypes1.length; param++) { if (param >= paramTypes2.length) { return 1; } final int test = paramTypes1[param].getName().compareTo(paramTypes2[param].getName()); if (test == 0) { continue; } return test; } if (paramTypes1.length == paramTypes2.length) { return 0; } return -1; } private  Args(); @SuppressWarnings("PMD.UseVarargs") // not needed for comparing one array to another static int compare(final Class<?>[] paramTypes1, final Class<?>[] paramTypes2);  }