News for hackers. Stuff that matters.
Re:Java 18 / JDK 18: General Availability by vips7L on Tuesday March 22, 2022 @05:48PM (#30772004)
> exact code to open a file, read each of the lines, and then close everything

    var lines = Files.lines(Paths.get("file.txt"));
or if you want to be extremely cautious:

    try (var lines = Files.lines(Paths.get("file.txt"))) {

    }

I agree about IOException though. It's the bane of my existence :) The amount of times I have to rethrow UncheckedIOException is far too high.

There are no comments on this comment yet.