Package com.jidesoft.comparator
Class AlphanumFileComparator
java.lang.Object
com.jidesoft.comparator.AlphanumFileComparator
- All Implemented Interfaces:
Comparator<File>
A File comparator to compare the file name based on alphanum value. This class is copied from
AlphanumComparator
except changing it to use File instead of CharSequence.-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCreates a case sensitive comparator to use the alphanum algorithm to compare the strings.AlphanumFileComparator
(boolean caseSensitive) Creates a comparator to use the alphanum algorithm to compare the strings. -
Method Summary
Modifier and TypeMethodDescriptionint
boolean
Checks if the case is sensitive when comparing.void
setCaseSensitive
(boolean caseSensitive) Sets the case sensitive flag.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
-
CONTEXT
-
CONTEXT_IGNORE_CASE
-
-
Constructor Details
-
AlphanumFileComparator
public AlphanumFileComparator()Creates a case sensitive comparator to use the alphanum algorithm to compare the strings. -
AlphanumFileComparator
public AlphanumFileComparator(boolean caseSensitive) Creates a comparator to use the alphanum algorithm to compare the strings.- Parameters:
caseSensitive
- true or false.
-
-
Method Details
-
compare
- Specified by:
compare
in interfaceComparator<File>
-
isCaseSensitive
public boolean isCaseSensitive()Checks if the case is sensitive when comparing.- Returns:
- true if the comparator is case sensitive.
-
setCaseSensitive
public void setCaseSensitive(boolean caseSensitive) Sets the case sensitive flag. By default, it's true meaning the comparator is case sensitive.- Parameters:
caseSensitive
- true or false.
-