RFR: 8358533: Improve performance of java.io.Reader.readAllLines [v3]
Brian Burkhalter
bpb at openjdk.org
Tue Jun 24 18:55:37 UTC 2025
On Tue, 24 Jun 2025 18:46:49 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:
>> The `readAllLines` method has a specification of line terminators that agrees with that of `BufferedReader::readLine` and `String::lines` and so we don't want to change it to be different.
>>
>> Unfortunately `Scanner` doesn't seem to have a specification of what it considers to be a line. Also unfortunately, its notion of line separators isn't the same as the regex pattern `\R`.
>
>> It might be worth adding a test of unconventional sequences or \r and \n, including \r\r and \n\n, \r.
>
> I think that the test changes in [d5abfa4](https://github.com/openjdk/jdk/pull/25863/commits/d5abfa450cb3fcd604560833038735e41952bce9
> ) cover this.
> The `readAllLines` method has a specification of line terminators that agrees [...].
The version in [d5abfa4](https://github.com/openjdk/jdk/pull/25863/commits/d5abfa450cb3fcd604560833038735e41952bce9) adheres to this.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25863#discussion_r2164682450
More information about the core-libs-dev
mailing list