Class FilenameSorter

java.lang.Object
com.levigo.jadice.web.demo.common.server.log.FilenameSorter

public class FilenameSorter extends Object
Compare 2 String objects and use the standard comparison for most of the cases. The special case is for the following situation: If the prefix before the last "." of both Strings is the same and the postfix is in both cases a number, like "enterprisedemo.log.4" vs. "enterprisedemo.log.33", sort by only taking the postfix into account. In the above case "4" would appear before "33" therefore, while the standard sorting would show "33" first.
  • Constructor Details

    • FilenameSorter

      public FilenameSorter()
  • Method Details

    • sortFiles

      public static ArrayList<String> sortFiles(String[] strings)
      Sort like described in the class javadoc.
      Parameters:
      strings - an array of Strings, intended to be a list of filenames
      Returns:
      the sorted objects, stored in a new ArrayList
    • sortFiles

      public static ArrayList<File> sortFiles(File[] files)
      Sort like described in the class javadoc.
      Parameters:
      files - an array of files, which shall be sorted according to their name.
      Returns:
      the sorted objects, stored in a new ArrayList