I\'m trying to find a file based on the first 8 numbers i pull from an excel sheet for each iteration. Whenever I use the code below I get the error message \"Local variable Cas
You can use inner class instead of anonymous one. Define it like:
private static class CaseIDFilenameFilter implements FilenameFilter {
private final String caseID;
private CaseIDFilenameFilter(String caseID) {
this.caseID = caseID;
}
@Override
public boolean accept(File dir, String name) {
return name.startsWith(caseID);
}
}
And then use it in your code like:
FilenameFilter filter = new CaseIDFilenameFilter(str);