Package org.apache.jorphan.util
Class AlphaNumericComparator<T>
java.lang.Object
org.apache.jorphan.util.AlphaNumericComparator<T>
- All Implemented Interfaces:
- Comparator<T>
Comparator for Objects, that compares based on their converted values. The objects will be
 converted to a String value using the given 
Function. That value
 will be compared in a human readable fashion by trying to parse numbers that appear in
 the keys as integers and compare those, too.Heavily influenced by https://codereview.stackexchange.com/questions/37192/number-aware-string-sorting-with-comparator
- 
Field SummaryFields
- 
Constructor SummaryConstructorsConstructorDescriptionAlphaNumericComparator(Function<? super T, String> converter) Constructs a comparator with a converter function
- 
Method SummaryMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Comparatorequals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
- 
Field Details- 
TO_STRING_COMPARATOR
 
- 
- 
Constructor Details- 
AlphaNumericComparatorConstructs a comparator with a converter function- Parameters:
- converter- that generates a String value from the arguments given to- Comparator.compare(Object, Object)
 
 
- 
- 
Method Details- 
compare- Specified by:
- comparein interface- Comparator<T>
 
 
-