Class AlphanumComparator<T>
java.lang.Object
io.goobi.viewer.controller.sorting.AlphanumComparator<T>
- Type Parameters:
T- the type of elements to be compared
- All Implemented Interfaces:
Serializable,Comparator<T>
Comparator implementing the Alphanum algorithm, which sorts strings containing numbers in natural
numeric order rather than ASCII order, with locale-aware collation and optional translation support.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionAlphanumComparator(boolean asc, Locale locale, ITranslator<T> translator) AlphanumComparator(boolean asc, Locale locale, Function<T, String> stringifier) -
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
-
AlphanumComparator
-
AlphanumComparator
-
AlphanumComparator
-
AlphanumComparator
-
-
Method Details
-
compare
- Specified by:
comparein interfaceComparator<T>- Parameters:
o1- first object to compareo2- second object to compare- Returns:
- a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second
-
normalizeString
- Parameters:
s- String to normalizeignoreChars- Optional string containing leading characters to remove from the string- Returns:
- Cleaned-up string for comparison
-