PreparedFoldersMapRaw - ViiSE/papka GitHub Wiki

PreparedFoldersMapRaw

PreparedFoldersMapRaw - prepares raw data to map [key, value]: [folder name, list of files of this folder].

Constructors

public PreparedFoldersMapRaw(List<String> rawFiles)

List<String> rawFiles - list of raw files (file is full filename).
public PreparedFoldersMapRaw(FoldersFile<String, String> foldersFile, List<String> rawFiles)


FoldersFile<String, String> foldersFile - folders name of file (default - FoldersFileName);
List<String> rawFiles - list of raw files (file is full filename).

Example

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, List<String>>> prepFolders = new PreparedFoldersMapRaw(rawFiles);

Map<String, List<String>> mapRaw = prepFolders.preparation();
mapRaw.forEach((fullFolderName, prepFiles) -> {
        System.out.println(fullFolderName); 
        prepFiles.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

Links

PreparedFolders - implementable interface.

FoldersFileName - default value constructor.

⚠️ **GitHub.com Fallback** ⚠️