I have a task to "move" my throws Exception from main() to lambda-expression. That means that when exception occurs in Lambda, the program uses throws from main. The problem is that I can't create any other interface which could automatically do that, because my teacher said to use only interface from java.util.Function and I've been looking in the internet, but mostly there are answers like "create new interface".
public static void main(String[] args) throws IOException {
Function<String, List<String>> flines = (String x) -> {
Stream<String> streamString = Files.lines(Paths.get(x)); //Should throw Exception from main if IOException
List<String> tmp = streamString.collect(Collectors.toList());
return tmp;
};