RFR: 8358533: Improve performance of java.io.Reader.readAllLines
Xueming Shen
sherman at openjdk.org
Wed Jun 18 02:36:33 UTC 2025
On Wed, 18 Jun 2025 01:34:14 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:
>> src/java.base/share/classes/java/io/Reader.java line 469:
>>
>>> 467: if (c == '\r' || c == '\n')
>>> 468: break;
>>> 469: term++;
>>
>> It might be worth adding a test of unconventional sequences or \r and \n, including \r\r and \n\n, \r.
>> The current ReadAll test cover the conventional sequences on Linux and Windows.
>
> I agree. I was intending to follow up on @jaikiran's [comment](https://github.com/openjdk/jdk/pull/24728#discussion_r2112052404), probably in an update to this request.
I think we should treat "\r\n" as a single line terminator? for example
"hello\r\nworld".lines().forEach(line -> out.format("[%s]\n", line));
=>
[hello]
[world]
instead of
[hello]
[]
[world]
or I misread the impl?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25863#discussion_r2153515129
More information about the core-libs-dev
mailing list