FilterFiles - ViiSE/papka GitHub Wiki

FilterFiles

FilterFiles<T> - filter by files.

Constructors

public FilterFiles(Find<List<T>, String> find, String regex)


Find<List<T>, String> find - find by files;
String regex - filter criteria.

Example

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

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

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

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

Folder<String> folder = new FolderPure<>(
        new NameFolderRoot(),
        rootFiles,
        new FolderPure<>(
                "/child1",
                child1),
        new FolderPure<>(
                "/child2",
                child2,
                new FolderPure<>(
                        "/child1/child2_1",
                        child2_1)));

Filter<List<String>> filter = new FilterFiles<>(
        new FindByStartWith<>(
                new FindFilesByFolderNameRegex<>(folder, false)),
        "child2");
List<String> files = filter.apply();
files.forEach(System.out::println);
Output:

child2.txt
child2.png
child2_1.txt
child2_1.png

Links

Filter - implementable interface.

Find - constructor argument.

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