SearchFolderChildByShortName - ViiSE/papka GitHub Wiki
SearchFolderChildByShortName<T> - search folder among children.
public SearchFolderChildByShortName(List<Folder<T>> children)
List<Folder<T>> children - list of children to search in.
List<String> rootFiles = new ArrayList<>();
rootFiles.add("root1.png");
rootFiles.add("root2.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");
Folder<String> root = new FolderPure<>(
new NameFolderRoot(),
rootFiles,
new FolderPure<>(
"/child1",
child1Files),
new FolderPure<>(
"/child2",
child2Files));
SearchFolder<String, String> search = new SearchFolderChildByShortName<>(root.children());
Folder<String> folder = search.answer("child2");
System.out.println(folder.fullName());
System.out.println(folder.shortName());
folder.files().forEach(file -> System.out.println("\t" + file));
Output:
/child2
child2
child2.txt
child2.png
SearchFolder - implementable interface.