I have problem with lambda expression. My code:
public static void main(String[] args) {
    Function<String, String> lambda = path -> {
        String result = null;
        try {
            BufferedReader br = new BufferedReader(new FileReader(path));
            String line;
            while ((line = br.readLine()) != null) {
                result = result + line;
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
        return result;
    };
}
I'm trying now to make code like that:
public static void main(String[] args) throws IOException {
    Function<String, String> lambda = path -> {
        String result = null;
        BufferedReader br = new BufferedReader(new FileReader(path));
        String line;
        while ((line = br.readLine()) != null) {
            result = result + line;
        }
        return result;
    };
}
Is that possible? I can use only java.util.function. I try to delete try catch from "lambda" and my "main" method should be catching that Exception.
 
     
     
    