@Test void collectFiles() { Assertions.assertEquals(4, FileUtils.collectFiles(directory).getChildren().size()); }
public static Node<File> collectFiles(File directory) { Node<File> tree = new Node<>(directory); if (!directory.isDirectory()) { return tree; } File[] files = directory.listFiles(); if (files == null) { return tree; } for (File file : files) { tree.add(file.isDirectory() ? collectFiles(file) : new Node<>(file)); } return tree; }
FileUtils { public static Node<File> collectFiles(File directory) { Node<File> tree = new Node<>(directory); if (!directory.isDirectory()) { return tree; } File[] files = directory.listFiles(); if (files == null) { return tree; } for (File file : files) { tree.add(file.isDirectory() ? collectFiles(file) : new Node<>(file)); } return tree; } }
FileUtils { public static Node<File> collectFiles(File directory) { Node<File> tree = new Node<>(directory); if (!directory.isDirectory()) { return tree; } File[] files = directory.listFiles(); if (files == null) { return tree; } for (File file : files) { tree.add(file.isDirectory() ? collectFiles(file) : new Node<>(file)); } return tree; } private  FileUtils(); }
FileUtils { public static Node<File> collectFiles(File directory) { Node<File> tree = new Node<>(directory); if (!directory.isDirectory()) { return tree; } File[] files = directory.listFiles(); if (files == null) { return tree; } for (File file : files) { tree.add(file.isDirectory() ? collectFiles(file) : new Node<>(file)); } return tree; } private  FileUtils(); static boolean contains(File[] files, String fileName); static int getAmountOfFiles(File directory); static String getContentOfFile(File file); static String[] getContentAsLines(File file); static Collection<File> findFilesByExtension(String directory, String extension); static Collection<File> findFilesByExtension(File directory, String extension); static Node<File> collectFiles(File directory); static void overrideFile(File file, String content); static boolean delete(File file); static File[] toFiles(String... paths); static String getName(File file); static String getName(URL url); static String getName(String path); }
FileUtils { public static Node<File> collectFiles(File directory) { Node<File> tree = new Node<>(directory); if (!directory.isDirectory()) { return tree; } File[] files = directory.listFiles(); if (files == null) { return tree; } for (File file : files) { tree.add(file.isDirectory() ? collectFiles(file) : new Node<>(file)); } return tree; } private  FileUtils(); static boolean contains(File[] files, String fileName); static int getAmountOfFiles(File directory); static String getContentOfFile(File file); static String[] getContentAsLines(File file); static Collection<File> findFilesByExtension(String directory, String extension); static Collection<File> findFilesByExtension(File directory, String extension); static Node<File> collectFiles(File directory); static void overrideFile(File file, String content); static boolean delete(File file); static File[] toFiles(String... paths); static String getName(File file); static String getName(URL url); static String getName(String path);  }