Here you can find the source of getPreorderList(Path root)
Parameter | Description |
---|---|
root | a parameter |
public static List<Path> getPreorderList(Path root)
//package com.java2s; //License from project: Open Source License import java.io.File; import java.nio.file.Path; import java.util.ArrayList; import java.util.List; public class Main { /**//from www. jav a 2s . c o m * Get a list of all files and subfiles in the root directory. The files are visited and returned in * preorder * * @param root * @return */ public static List<Path> getPreorderList(Path root) { List<Path> allFiles = new ArrayList<Path>(); listFiles(root, allFiles); return allFiles; } private static void listFiles(Path path, List<Path> preorderList) { preorderList.add(path); File[] listFiles = path.toFile().listFiles(); if (listFiles != null) for (File child : listFiles) { listFiles(child.toPath(), preorderList); } } }