Returns a comparator with natural order.

@param <T> the type of the objects compared by the comparator
@return a comparator
494504
@NotNull
    @SuppressWarnings("unchecked")
    public static <T extends Comparable<? super T>> ComparatorCompat<T> naturalOrder() {
        return (ComparatorCompat<T>) NATURAL_ORDER;
    }
616923
public static Comparator<CmsAliasTableRow> getComparator() {

        return new Comparator<CmsAliasTableRow>() {

            public int compare(CmsAliasTableRow o1, CmsAliasTableRow o2) {

                String err1 = getValueInternal(o1);
                String err2 = getValueInternal(o2);
                if ((err1 == null) && (err2 == null)) {
                    return 0;
                }
                if (err1 == null) {
                    return -1;
                }
                if (err2 == null) {
                    return 1;
                }
                return 0;
            }
        };
    }
336049
public static <T extends Comparable<? super T>> Collector<T, ?, Seq<T>> minAll() {
        return minAllBy(t -> t, naturalOrder());
    }
802794
public static ComparatorItem fromSortOrder(Sort.Order sortOrder) {
    if (sortOrder == null || sortOrder.getProperty() == null
        || sortOrder.getProperty().trim().length() == 0) {
      return null;
    }
    boolean nullIsFirst = Sort.NullHandling.NULLS_FIRST.equals(sortOrder.getNullHandling());
    return new ComparatorItem(sortOrder.getProperty(), sortOrder.isAscending(),
        sortOrder.isIgnoreCase(),
        nullIsFirst);
  }
500572
public Comparator<Columns> comparator() {
        return new Comparator<Columns>() {
            public int compare(Columns o1, Columns o2) {

                if (o1 == null) {
                    return o2 == null ? 0 : 1;
                }
                if (o2 == null) {
                    return -1;
                }

                Column column1 = o1.getColumn(field);
                Column column2 = o2.getColumn(field);

                if (column1 == null) {
                    return column2 == null ? 0 : 1;
                }
                if (column2 == null) {
                    return -1;
                }

                AbstractType<?> type = column1.getType();
                ByteBuffer value1 = column1.getDecomposedValue();
                ByteBuffer value2 = column2.getDecomposedValue();
                return reverse ? type.compare(value2, value1) : type.compare(value1, value2);
            }
        };
    }
1157763
@NotNull
    @SuppressWarnings("unchecked")
    public static <T extends Comparable<? super T>> ComparatorCompat<T> reverseOrder() {
        return (ComparatorCompat<T>) REVERSE_ORDER;
    }
658546
public static <T, L extends List<T>> L sortThis(L list, Comparator<? super T> comparator)
    {
        if (list instanceof MutableList)
        {
            ((MutableList<T>) list).sortThis(comparator);
        }
        else if (list instanceof ArrayList)
        {
            ArrayListIterate.sortThis((ArrayList<T>) list, comparator);
        }
        else
        {
            if (list.size() > 1)
            {
                Collections.sort(list, comparator);
            }
        }
        return list;
    }
1098868
public static <T> int compare(T a, T b, Comparator<? super T> c) {
        if (a == b) {
            return 0;
        }
        return c.compare(a, b);
    }
1249671
public static Comparator getComparator()
    {
        return new Comparator()
        {
            public int compare(Object o1, Object o2)
            {
                FieldDescriptor fmd1 = (FieldDescriptor) o1;
                FieldDescriptor fmd2 = (FieldDescriptor) o2;
                if (fmd1.getColNo() < fmd2.getColNo())
                {
                    return -1;
                }
                else if (fmd1.getColNo() > fmd2.getColNo())
                {
                    return 1;
                }
                else
                {
                    return 0;
                }
            }
        };
    }
1359454
public static <T extends List<? extends U>, U> Comparator<T> canonicalComparator(Comparator<? super U> elemComp) {
        return new CanonicalComparator<>(elemComp);
    }
210269
public static <T extends Offset<T>> Ordering<OffsetRange<T>> byEarlierStartEarlierEndOrdering() {
    return Ordering.<T>natural().onResultOf(OffsetRange.<T>toStartInclusiveFunction())
        .compound(Ordering.<T>natural().onResultOf(OffsetRange.<T>toEndInclusiveFunction()));
  }
239728
public static <S extends Storable> Comparator<S>
        createComparator(OrderedProperty<S>... properties)
    {
        if (properties == null || properties.length == 0 || properties[0] == null) {
            throw new IllegalArgumentException();
        }

        Class<S> type = properties[0].getChainedProperty().getPrimeProperty().getEnclosingType();

        BeanComparator bc = BeanComparator.forClass(type);

        for (OrderedProperty<S> property : properties) {
            if (property == null) {
                throw new IllegalArgumentException();
            }
            bc = orderBy(bc, property);
        }

        return bc;
    }
63782
@Override
  @SuppressWarnings("unchecked")
  public <E> Comparator<E> getOrderBy() {
    return ObjectUtils.defaultIfNull(ComparatorHolder.get(), ObjectUtils.defaultIfNull(
      orderBy, ComparableComparator.INSTANCE));
  }
267295
public static <ElementType> Ordering<Multiset.Entry<ElementType>> byCountOrdering() {
    return Ordering.natural().onResultOf(MultisetUtils.<ElementType>toCountFunction());
  }
892559
public static <K, V extends Comparable<V>> Ordering<Map.Entry<K, V>> byValueOrderingAscending() {
    return Ordering.<V>natural().onResultOf(MapUtils.<K, V>getEntryValue());
  }
813647
public static <T extends Comparable<T>> Pair<T, T> ordered(T lhs, T rhs) {
        return new MakeOrder<T>(new ComparableComparator<T>()).apply(lhs, rhs);
    }
526475
public static final <T extends Comparable<T>> Ordering<Scored<T>> ByItemOnly() {
    return Ordering.natural().onResultOf(Scoreds.<T>itemsOnly());
  }