public class NaturalOrderComparator
extends java.lang.Object
implements java.util.Comparator<java.lang.String>
this does not return anything as equal unless they are the same string.
class is thread-safe.
nulls not supported. to support nulls, wrap in guava:
Ordering.from(NaturalOrderComparator.INSTANCE).nullsFirst()
)
Based on https://github.com/paour/natorder
Modifier and Type | Field and Description |
---|---|
static NaturalOrderComparator |
INSTANCE |
Constructor and Description |
---|
NaturalOrderComparator() |
Modifier and Type | Method and Description |
---|---|
int |
compare(java.lang.String a,
java.lang.String b) |
public static final NaturalOrderComparator INSTANCE