I'm currently working on an assignment which consists of creating a utility class with a method allowing to search for files/directories by name in a given (as a parameter) directory.
The drill is that I am obligated to do this within the realms of functional programming / stream processing.
I have tried to achieve this using .walk() and .find() but it wouldn't work
public static List<File> findFile(Path path, String name) throws IOException{
    return Files.walk(path)
            .filter(n -> n.getFileName().toString().equals(name))
            .map(n -> n.toFile())
            .collect(Collectors.toList());
}
 
     
     
    