SearchFolderByShortName - ViiSE/papka GitHub Wiki
SearchFolderByShortName<T> - search folder by short folder name.
public SearchFolderByShortName(Folder<T> folder)
Folder<T> folder - folder to search in.
public SearchFolderByShortName(Folder<T> folder, boolean isLast)
Folder<T> folder - folder to search in;
boolean isLast - search folder to end of folder tree or search to first match with search criteria? (default false)
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 SearchFolderByShortName<>(root);
Folder<String> folder = search.answer("child1");
System.out.println(folder.fullName());
System.out.println(folder.shortName());
folder.files().forEach(file -> System.out.println("\t" + file));
Output:
/child1
child1
child1.txt
child1.png
SearchFolder - implementable interface.