Java Path File List nio findExpectedResultForTestcase(final Path testcase, final LinkedList expectedResults)

Here you can find the source of findExpectedResultForTestcase(final Path testcase, final LinkedList expectedResults)

Description

find Expected Result For Testcase

License

Open Source License

Declaration

public static Path findExpectedResultForTestcase(final Path testcase, final LinkedList<Path> expectedResults) 

Method Source Code


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

import java.nio.file.Path;
import java.util.Iterator;
import java.util.LinkedList;

public class Main {
    public static Path findExpectedResultForTestcase(final Path testcase, final LinkedList<Path> expectedResults) {
        final String fileName = getFileName(testcase);

        final Iterator<Path> it = expectedResults.iterator();
        while (it.hasNext()) {
            final Path result = it.next();
            if (fileName.equalsIgnoreCase(getFileName(result))) {
                it.remove();/*from   w w w  . j a v  a 2  s  .c o m*/
                return result;
            }
        }

        return null;
    }

    public static String getFileName(final Path path) {
        return path.getFileName().toString();
    }
}

Related

  1. asFileList(Object... paths)
  2. asPathsList(final File[] files)
  3. compileTreeWithErrors(JavaCompiler compiler, List options, File targetFolder, DiagnosticListener diagnosticListener, boolean addProcessorsToClasspath)
  4. deepListChildren(Path directory)
  5. fileListDeep(Path dir)
  6. getClassLoaderFromPaths(ArrayList paths)
  7. getDirectoryList(Path basePath)
  8. getPreorderList(Path root)
  9. getSortedPathList(final Path dir, final boolean dirsFirst)