@Test public void testSortPreorder() { List<File> files = new ArrayList<File>(); File aaa = new File("/aaa"); files.add(aaa); File bbb = new File("/bbb"); files.add(bbb); File c = new File(aaa, "c.txt"); files.add(c); File d = new File("/bzz", "d.txt"); files.add(d); File bzz = new File("/bzz"); files.add(bzz); FileUtil.sortPreorder(files); int index = 0; Assert.assertEquals(aaa, files.get(index++)); Assert.assertEquals(c, files.get(index++)); Assert.assertEquals(bbb, files.get(index++)); Assert.assertEquals(bzz, files.get(index++)); Assert.assertEquals(d, files.get(index++)); }
public static void sortPreorder(List<File> unsortedFiles) { Collections.sort(unsortedFiles, new Comparator<File>() { @Override public int compare(File o1, File o2) { return o1.getAbsolutePath().compareTo(o2.getAbsolutePath()); } }); }
FileUtil { public static void sortPreorder(List<File> unsortedFiles) { Collections.sort(unsortedFiles, new Comparator<File>() { @Override public int compare(File o1, File o2) { return o1.getAbsolutePath().compareTo(o2.getAbsolutePath()); } }); } }
FileUtil { public static void sortPreorder(List<File> unsortedFiles) { Collections.sort(unsortedFiles, new Comparator<File>() { @Override public int compare(File o1, File o2) { return o1.getAbsolutePath().compareTo(o2.getAbsolutePath()); } }); } private  FileUtil(); }
FileUtil { public static void sortPreorder(List<File> unsortedFiles) { Collections.sort(unsortedFiles, new Comparator<File>() { @Override public int compare(File o1, File o2) { return o1.getAbsolutePath().compareTo(o2.getAbsolutePath()); } }); } private  FileUtil(); static void writePersistentMetaData(IFileAgent fileAgent, PublicKeyManager keyManager, IH2HSerialize serializer); static PersistentMetaData readPersistentMetaData(IFileAgent fileAgent, IH2HSerialize serializer); static String getFileSep(); static File relativize(File base, File child); static long getFileSize(File file); static boolean isInH2HDirectory(File file, File root); static boolean isInH2HDirectory(IFileAgent fileAgent, File file); static void sortPreorder(List<File> unsortedFiles); }
FileUtil { public static void sortPreorder(List<File> unsortedFiles) { Collections.sort(unsortedFiles, new Comparator<File>() { @Override public int compare(File o1, File o2) { return o1.getAbsolutePath().compareTo(o2.getAbsolutePath()); } }); } private  FileUtil(); static void writePersistentMetaData(IFileAgent fileAgent, PublicKeyManager keyManager, IH2HSerialize serializer); static PersistentMetaData readPersistentMetaData(IFileAgent fileAgent, IH2HSerialize serializer); static String getFileSep(); static File relativize(File base, File child); static long getFileSize(File file); static boolean isInH2HDirectory(File file, File root); static boolean isInH2HDirectory(IFileAgent fileAgent, File file); static void sortPreorder(List<File> unsortedFiles);  }