TreeFolderPure - ViiSE/papka GitHub Wiki
TreeFolderPure<T> - main implementation of the tree building algorithm.
public TreeFolderPure(PreparedFolders<Map<String, Folder<T>>> prepFolders)
Map<String, Folder<T>>> prepFolders - prepared folders map.
public TreeFolderPure(
FoldersFile<String, String> foldersFile,
PreparedFolders<Map<String, Folder<T>>> prepFolders)
FoldersFile<String, String> foldersFile - folders name of file (default - FoldersFileName);
Map<String, Folder<T>>> prepFolders - prepared folders map.
List<String> rawFiles = new ArrayList<>();
rawFiles.add("/root1.txt");
rawFiles.add("/root2.txt");
rawFiles.add("/root3.txt");
rawFiles.add("/folder1/file1.txt");
rawFiles.add("/folder1/file2.txt");
rawFiles.add("/folder2/file1.txt");
PreparedFolders<Map<String, Folder<String>>> prepFolders = new PreparedFoldersMapText(
new PreparedFoldersMapRaw(rawFiles));
TreeFolder<String> trFolder = new TreeFolderPure<>(
new FoldersFileName(),
prepFolders);
Folder<String> root = trFolder.grow();
root.travel(folder -> {
System.out.println(folder.fullName());
folder.files().forEach(file -> System.out.println("\t" + file));
});
Output:
/
root1.txt
root2.txt
root3.txt
/folder1
file1.txt
file2.txt
/folder2
file1.txt
PreparedFolders - implementable interface.
FoldersFileName - default value constructor.