FolderPure - ViiSE/papka GitHub Wiki

FolderPure

FolderPure<T> - main implementation of interface Folder<T>.

Constructors

public FolderPure(String fullName, List<T> files)


String fullName - full name folder;
List<T> files - list of files.
public FolderPure(String fullName, T... files)


String fullName - full name folder;
T... files - save varargs files.
public FolderPure(String fullName, List<T> files, List<Folder<T>> children)


String fullName - full name folder;
List<T> files - list of files;
List<Folder<T>> children - list of children.
public FolderPure(Name name, List<T> files)


Name name - name folder (default - NamePure);
List<T> files - list of files.
public FolderPure(Name name, T... files)


Name name - name folder (default - NamePure);
T... files - save varargs files.
public FolderPure(Name name, List<T> files, Folder<T>... children)


Name name - name folder (default - NamePure);
List<T> files - list of files;
T... children - save varargs children.
public FolderPure(Name name, List<T> files, List<Folder<T>> children)


Name name - name folder (default - NamePure);
List<T> files - list of files;
List<Folder<T>> children - list of children.

Example

List<String> rootFiles = new ArrayList<String>() {{
            add("file1.png");
            add("file2.png");
        }};

Folder<String> child = new FolderPure<>(
        "/music",
        new ArrayList<String>() {{
            add("musicA.mp3"); }});

Folder<String> root = new FolderPure<>(
        new NameFolderRoot(),
        rootFiles,
        new ArrayList<Folder<String>>() {{
            add(child);
        }});

root.travel(folder -> {
    System.out.println("Full Name: " + folder.fullName()); 
    System.out.println("Short Name: " + folder.shortName());
    System.out.println("Files:");
    folder.files().forEach(file -> System.out.println("\t" + file));
    System.out.println("Children:");
    folder.children().forEach(child -> System.out.println("\t" + child.shortName()));
    System.out.println();
});
Output:

Full Name: /
Short Name: /
Files:
    file1.png
    file2.png
Children:
    music

Full Name: /music
Short Name: music
Files:
    musicA.mp3
Children:

Links

Folder - implementable interface.

NamePure - default value constructor.

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