I'm new and I have a question. How can I close a file in java using functional programming(using lambda)?
How can I convert for example file.close() into something that looks in a functional manner?
I'm new and I have a question. How can I close a file in java using functional programming(using lambda)?
How can I convert for example file.close() into something that looks in a functional manner?
The closest you can get to clean the 'close a resource' is try with resources (But thats not functional..):
try (BufferedReader br = new BufferedReader(new FileReader("myfile")){
} catch (IOException e) {
e.printStackTrace();
}