/** * Return a decorator for the given comparator which accepts * null values and sorts them higher than non-null values. * @see NullSafeComparator#NullSafeComparator(boolean) */ public static <T> Comparator<T> nullsHigh(Comparator<T> comparator) { return new NullSafeComparator<>(comparator, false); }
/** * Return a decorator for the given comparator which accepts * null values and sorts them lower than non-null values. * @see NullSafeComparator#NullSafeComparator(boolean) */ public static <T> Comparator<T> nullsLow(Comparator<T> comparator) { return new NullSafeComparator<>(comparator, true); }
/** * Return a decorator for the given comparator which accepts * null values and sorts them lower than non-null values. * @see NullSafeComparator#NullSafeComparator(boolean) */ public static <T> Comparator<T> nullsLow(Comparator<T> comparator) { return new NullSafeComparator<>(comparator, true); }
/** * Return a decorator for the given comparator which accepts * null values and sorts them higher than non-null values. * @see NullSafeComparator#NullSafeComparator(boolean) */ public static <T> Comparator<T> nullsHigh(Comparator<T> comparator) { return new NullSafeComparator<>(comparator, false); }
public int compare(Object o1, Object o2) { LabeledEnum e1 = (LabeledEnum) o1; LabeledEnum e2 = (LabeledEnum) o2; Comparator comp = new NullSafeComparator(String.CASE_INSENSITIVE_ORDER, true); return comp.compare(e1.getLabel(), e2.getLabel()); } };
/** * Return a decorator for the given comparator which accepts * null values and sorts them higher than non-null values. * @see NullSafeComparator#NullSafeComparator(boolean) */ public static <T> Comparator<T> nullsHigh(Comparator<T> comparator) { return new NullSafeComparator<>(comparator, false); }
/** * Return a decorator for the given comparator which accepts * null values and sorts them lower than non-null values. * @see NullSafeComparator#NullSafeComparator(boolean) */ public static <T> Comparator<T> nullsLow(Comparator<T> comparator) { return new NullSafeComparator<>(comparator, true); }
/** * Return a decorator for the given comparator which accepts * null values and sorts them lower than non-null values. * @see NullSafeComparator#NullSafeComparator(boolean) */ public static <T> Comparator<T> nullsLow(Comparator<T> comparator) { return new NullSafeComparator<>(comparator, true); }
/** * Return a decorator for the given comparator which accepts * null values and sorts them higher than non-null values. * @see NullSafeComparator#NullSafeComparator(boolean) */ public static <T> Comparator<T> nullsHigh(Comparator<T> comparator) { return new NullSafeComparator<>(comparator, false); }
public int compare(Object o1, Object o2) { LabeledEnum e1 = (LabeledEnum) o1; LabeledEnum e2 = (LabeledEnum) o2; Comparator comp = new NullSafeComparator(String.CASE_INSENSITIVE_ORDER, true); return comp.compare(e1.getLabel(), e2.getLabel()); } };