Documentation of 'org.clapper.util.io.FileNameComparator' Java class
FileNameComparator
org.clapper.util.io

Class FileNameComparator

  • All Implemented Interfaces:
    java.util.Comparator<java.lang.Object>


    public class FileNameComparator
    extends java.lang.Object
    implements java.util.Comparator<java.lang.Object>

    FileNameComparator implements a Comparator class that compares file names (expressed either as String or File objects) for sorting. The comparison can be case-sensitive or case-insensitive, and can apply to the entire path (if available) or just the file name part.

    • Constructor Summary

      Constructors 
      Constructor and Description
      FileNameComparator()
      Construct a new FileNameComparator with the default settings.
      FileNameComparator(boolean foldCase, boolean entirePath)
      Construct a new FileNameComparator.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      int compare(java.lang.Object o1, java.lang.Object o2)
      Compares its two arguments for order.
      boolean equals(java.lang.Object o)
      Indicates whether some other object is "equal to" this Comparator.
      int hashCode()
      Get the hash code for this object.
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.util.Comparator

        comparing, comparing, comparingDouble, comparingInt, comparingLong, naturalOrder, nullsFirst, nullsLast, reversed, reverseOrder, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
    • Constructor Detail

      • FileNameComparator

        public FileNameComparator()
        Construct a new FileNameComparator with the default settings. The default settings are:
        • Compare only file names, not paths
        • Use case-sensitive comparison
        Calling this constructor is equivalent to:
        Comparator cmp = new FileNameComparator (false, false);
      • FileNameComparator

        public FileNameComparator(boolean foldCase,
                                  boolean entirePath)
        Construct a new FileNameComparator.
        Parameters:
        foldCase - true for case-insensitive comparison, false for case-sensitive comparison
        entirePath - true to compare the entire path (where available, false to use just the name.
    • Method Detail

      • compare

        public int compare(java.lang.Object o1,
                           java.lang.Object o2)
        Compares its two arguments for order. Returns a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.
        Specified by:
        compare in interface java.util.Comparator<java.lang.Object>
        Parameters:
        o1 - the first object to be compared
        o2 - the second object to be compared
        Returns:
        a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.
      • equals

        public boolean equals(java.lang.Object o)

        Indicates whether some other object is "equal to" this Comparator.

        Specified by:
        equals in interface java.util.Comparator<java.lang.Object>
        Overrides:
        equals in class java.lang.Object
        Parameters:
        o - the object to compare
        Returns:
        true only if the pecified object is also a comparator and it imposes the same ordering as this comparator.
      • hashCode

        public int hashCode()
        Get the hash code for this object.
        Overrides:
        hashCode in class java.lang.Object
        Returns:
        the hash code

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.