/** * Sort the list of files. Recency as determined by the version component * of the file name. * * @param files array of files * @param prefix files not matching this prefix are assumed to have a * version = -1) * @param ascending true sorted in ascending order, false results in * descending order * @return sorted input files */ public static List<File> sortDataDir(File[] files, String prefix, boolean ascending) { if(files==null) return new ArrayList<File>(0); List<File> filelist = Arrays.asList(files); Collections.sort(filelist, new DataDirFileComparator(prefix, ascending)); return filelist; }
/** * Sort the list of files. Recency as determined by the version component * of the file name. * * @param files array of files * @param prefix files not matching this prefix are assumed to have a * version = -1) * @param ascending true sorted in ascending order, false results in * descending order * @return sorted input files */ public static List<File> sortDataDir(File[] files, String prefix, boolean ascending) { if(files==null) return new ArrayList<File>(0); List<File> filelist = Arrays.asList(files); Collections.sort(filelist, new DataDirFileComparator(prefix, ascending)); return filelist; }
/** * Sort the list of files. Recency as determined by the version component * of the file name. * * @param files array of files * @param prefix files not matching this prefix are assumed to have a * version = -1) * @param ascending true sorted in ascending order, false results in * descending order * @return sorted input files */ public static List<File> sortDataDir(File[] files, String prefix, boolean ascending) { if(files==null) return new ArrayList<File>(0); List<File> filelist = Arrays.asList(files); Collections.sort(filelist, new DataDirFileComparator(prefix, ascending)); return filelist; }