java.lang.Object
org.sejda.commons.util.NumericalSortFilenameComparator
- All Implemented Interfaces:
Comparator<File>
Comparator for filenames that performs a numerical sort if the file names start or end with digits. It allows to specify a fallback comparator to use in case the numerical sort
fails. The goal is to behave as close as possible to file managers sorting results.
- Author:
- Andrea Vacondio
-
Constructor Summary
ConstructorsConstructorDescriptionComparator performing numerical sort with fallback to file name case-insensitive compare in case numerical sort failsNumericalSortFilenameComparator(Comparator<File> fallback) -
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
-
NumericalSortFilenameComparator
- Parameters:
fallback- the comparator to use when numerical sorting fails. Default is file name case-insensitive compare
-
NumericalSortFilenameComparator
public NumericalSortFilenameComparator()Comparator performing numerical sort with fallback to file name case-insensitive compare in case numerical sort fails
-
-
Method Details
-
compare
- Specified by:
comparein interfaceComparator<File>
-