• A comparator that uses the comparison operators (>, <) to determine the order of any value.

    Works well for:

    • numbers
    • bigints
    • unlocalized strings
    • Date objects

    This should be used with caution as other comparators can be better suited to this task. For instance, you may prefer to sort strings with localizedStringComparator instead of relying on their unicode codepoints.

    Type Parameters

    • T

    Parameters

    Returns Comparator<T>