Class AlphanumFileComparator

  • All Implemented Interfaces:
    java.util.Comparator<java.io.File>

    public class AlphanumFileComparator
    extends java.lang.Object
    implements java.util.Comparator<java.io.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.
    • Constructor Summary

      Constructors 
      Constructor Description
      AlphanumFileComparator()
      Creates 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

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int compare​(java.io.File f1, java.io.File f2)  
      boolean isCaseSensitive()
      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
    • Constructor Detail

      • 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 Detail

      • compare

        public int compare​(java.io.File f1,
                           java.io.File f2)
        Specified by:
        compare in interface java.util.Comparator<java.io.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.