Here you can find the source of findExpectedResultForTestcase(final Path testcase, final LinkedList
public static Path findExpectedResultForTestcase(final Path testcase, final LinkedList<Path> expectedResults)
//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(); } }