PreparedFoldersMapText - ViiSE/papka GitHub Wiki
PreparedFoldersMapText - Prepares raw data to map
[key, value]: [folder name, instance of Folder with list of files of this folder].
public PreparedFoldersMapText(PreparedFolders<Map<String, List<String>>> prepFolders)
PreparedFolders<Map<String, List<String>>> prepFolders - decoration (default PreparedFoldersMapRaw).
List<String> rawFiles = new ArrayList<>();
rawFiles.add("/file1.txt");
rawFiles.add("/file2.txt");
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));
Map<String, Folder<String>> mapFolder = prepFolders.preparation();
mapFolder.forEach((fullFolderName, folder) -> {
System.out.println(fullFolderName);
prepFiles.forEach(folder ->
folder.files().forEach(file -> System.out.println("\t" + file))
);
}
);
Output:
/
file1.txt
file2.txt
root1.txt
root2.txt
root3.txt
/folder1
file1.txt
file2.txt
/folder2
file1.txt
PreparedFolders - implementable interface.
PreparedFoldersMapRaw - default value constructor.