News for hackers. Stuff that matters.
Re:Java 21: What’s New? by kaba0 on Thursday August 10, 2023 @04:39PM (#37081470)
How is OOM not a concern in case of C++, python? Java’s List is much more ergonomic that arrays.

Also, I really don’t understand your last example - that’s literally available in java returning a List of lines. If you add a .stream().collect(joining(“\n”)), you get the whole string in one go.

Re:Java 21: What’s New? by riku_iki on Thursday August 10, 2023 @04:43PM (#37081516)
> How is OOM not a concern in case of C++, python?

I think in python it will lazely iterate through the file, and not load everything at once

> Java’s List is much more ergonomic that arrays.

right, but commenter above proposed array..

> that’s literally available in java returning a List of lines.

current API has two issues:

- OOM if file is large

- it takes Path instance which you need to construct and not "String file" parameter, thus hit on ergonomics

Re:Java 21: What’s New? by kaba0 on Thursday August 10, 2023 @05:12PM (#37081870)
Path.of(yourString)
Re:Java 21: What’s New? by riku_iki on Thursday August 10, 2023 @05:18PM (#37081919)
I know, but why it is necessary?