On Tue, 3 Dec 2024 06:14:31 GMT, Jaikiran Pai <j...@openjdk.org> wrote:
>> src/java.base/linux/classes/jdk/internal/platform/CgroupSubsystemController.java >> line 68: >> >>> 66: try (Stream<String> lines = Files.lines(filePath)) { >>> 67: Optional<String> firstLine = lines.findFirst(); >>> 68: return firstLine.orElse(null); >> >> you could probably just: >> >> >> return lines.findFirst().orElse(null); >> >> >> unless the local variable is needed or type inference? > > Hello Daniel, no syntactical reason behind this. Severin proposed this style > in his review and I noticed that this area of the code has been using this > style of local variable assigment and immediate return in one or two other > places, so I decided to stick with it. I don't have a strong preference but > am willing to update it if you or others think we should. In that case you may leave it as is - it's fine with me. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/22478#discussion_r1867819610