@Test public void testCompareNullAware_4() { final String instance = "ab"; Assert.assertEquals(0, ComparisonUtil.compareNullAware(instance, new String(instance))); }
public static <T extends Comparable<T>> int compareNullAware(final T targetOne, final T targetTwo) { final int result; if (targetOne == targetTwo) { result = 0; } else if (targetOne == null) { result = -1; } else if (targetTwo == null) { result = 1; } else { result = targetOne.compareTo(targetTwo); } return result; }
ComparisonUtil { public static <T extends Comparable<T>> int compareNullAware(final T targetOne, final T targetTwo) { final int result; if (targetOne == targetTwo) { result = 0; } else if (targetOne == null) { result = -1; } else if (targetTwo == null) { result = 1; } else { result = targetOne.compareTo(targetTwo); } return result; } }
ComparisonUtil { public static <T extends Comparable<T>> int compareNullAware(final T targetOne, final T targetTwo) { final int result; if (targetOne == targetTwo) { result = 0; } else if (targetOne == null) { result = -1; } else if (targetTwo == null) { result = 1; } else { result = targetOne.compareTo(targetTwo); } return result; }  }
ComparisonUtil { public static <T extends Comparable<T>> int compareNullAware(final T targetOne, final T targetTwo) { final int result; if (targetOne == targetTwo) { result = 0; } else if (targetOne == null) { result = -1; } else if (targetTwo == null) { result = 1; } else { result = targetOne.compareTo(targetTwo); } return result; }  static boolean isNullAwareEqual(final Object targetOne, final Object targetTwo); static boolean isNullOrEmptyAwareEqual(final String targetOne, final String targetTwo); static boolean isNullOrEmptyAwareEqual(final List<?> targetOne, final List<?> targetTwo); static int compareNullAware(final T targetOne, final T targetTwo); }
ComparisonUtil { public static <T extends Comparable<T>> int compareNullAware(final T targetOne, final T targetTwo) { final int result; if (targetOne == targetTwo) { result = 0; } else if (targetOne == null) { result = -1; } else if (targetTwo == null) { result = 1; } else { result = targetOne.compareTo(targetTwo); } return result; }  static boolean isNullAwareEqual(final Object targetOne, final Object targetTwo); static boolean isNullOrEmptyAwareEqual(final String targetOne, final String targetTwo); static boolean isNullOrEmptyAwareEqual(final List<?> targetOne, final List<?> targetTwo); static int compareNullAware(final T targetOne, final T targetTwo);  }