Class NaturalSortComparator
java.lang.Object
org.apache.camel.component.zookeeper.NaturalSortComparator
- All Implemented Interfaces:
Comparator<CharSequence>
- Direct Known Subclasses:
SequenceComparator
NaturalSortComparator is a fast comparator for sorting a collection of Strings in a human readable
fashion.
This implementation considers sequences of digits to be positive integer values, '.' does not indicate a decimal value nor '-' a negative one. As a result, 12345.12345 will sort higher than 12345.5432 and -12346 will sort higher than 12345.
it does work well for sorting software versions e.g. camel-2.2.0 sorting higher than camel-2.1.0
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescription -
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Comparator
equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
Constructor Details
-
NaturalSortComparator
public NaturalSortComparator() -
NaturalSortComparator
-
-
Method Details
-
compare
- Specified by:
comparein interfaceComparator<CharSequence>
-