SearchFolderByFullName - ViiSE/papka GitHub Wiki

SearchFolderByFullName

SearchFolderByFullName<T> - search folder by full folder name.

Constructors

public SearchFolderByFullName(Folder<T> folder)


Folder<T> folder - folder to search in.

Example

List<String> rootFiles = new ArrayList<>();
rootFiles.add("root1.png");
rootFiles.add("root2.pdf");
rootFiles.add("childRoot1.pdf");
rootFiles.add("childRoot2.pdf");

List<String> child1Files = new ArrayList<>();
child1Files.add("child1.txt");
child1Files.add("child1.png");

List<String> child2Files = new ArrayList<>();
child2Files.add("child2.txt");
child2Files.add("child2.png");

List<String> child21Files = new ArrayList<>();
child21Files.add("child21.txt");
child21Files.add("child21.png");

Folder<String> root = new FolderPure<>(
        new NameFolderRoot(),
        rootFiles,
        new FolderPure<>(
                "/child1",
                child1Files),
        new FolderPure<>(
                "/child2",
                child2Files,
                new FolderPure<>(
                        "/child2/child21",
                        child21Files)));
SearchFolder<String, String> search = new SearchFolderByFullName<>(root);
Folder<String> folder = search.answer("/child2/child21");
System.out.println(folder.fullName());
System.out.println(folder.shortName());
folder.files().forEach(file -> System.out.println("\t" + file));
Output:

/child2/child21
child21
    child21.txt
    child21.png

Links

SearchFolder - implementable interface.

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