Java Path File List nio asFileList(Object... paths)

Here you can find the source of asFileList(Object... paths)

Description

as File List

License

Open Source License

Declaration

public static List<File> asFileList(Object... paths) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.io.File;

import java.nio.file.Path;

import java.util.ArrayList;
import java.util.Collection;

import java.util.List;

public class Main {
    public static List<File> asFileList(Object... paths) {
        List<File> files = new ArrayList<File>(paths.length);
        for (Object it : paths) {
            if (it instanceof CharSequence) {
                files.add(new File(it.toString()));
            } else if (it instanceof File) {
                files.add((File) it);
            } else if (it instanceof Path) {
                files.add(((Path) it).toFile());
            } else if (it instanceof Collection<?>) {
                files.addAll(asFileList(((Collection<?>) it).toArray())); // flatten object structure
            }//  www.j  ava  2 s. c o m
        }
        return files;
    }
}

Related

  1. addNonEmptyLinesFromFile(final ArrayList result, final String path)
  2. anyPathMatcher(final ImmutableList pathMatchers)
  3. archive(Path archive, List targetFiles)
  4. asPathsList(final File[] files)
  5. compileTreeWithErrors(JavaCompiler compiler, List options, File targetFolder, DiagnosticListener diagnosticListener, boolean addProcessorsToClasspath)
  6. deepListChildren(Path directory)
  7. fileListDeep(Path dir)