java.lang.Object
com.aoapps.lang.text.SmartComparator
- All Implemented Interfaces:
Comparator<Object>
Compares strings in a case-insensitive, locale-aware manner. Also supports
integer ranges within the string so would be sorted in the following order:
- 1A
- 2A
- 10A
- 11A
- 11a
- 12
- B
- Author:
- AO Industries, Inc.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final SmartComparator
The smart comparator for the root locale. -
Constructor Summary
-
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.Comparator
equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
Field Details
-
ROOT
The smart comparator for the root locale.
-
-
Constructor Details
-
SmartComparator
-
SmartComparator
-
SmartComparator
public SmartComparator()
-
-
Method Details
-
compare
Compares two objects by theirObject.toString()
values.- Specified by:
compare
in interfaceComparator<Object>
- See Also:
-
compare
Compares two strings, supportingnull
. Sorts nulls after non-nulls.This choice of nulls after non-nulls is selected to be consistent with PostgreSQL's default "NULLS LAST" ordering.
-