RFR: 8341566: Add Reader.of(CharSequence) [v10]
Markus KARG
duke at openjdk.org
Fri Oct 11 22:49:15 UTC 2024
On Fri, 11 Oct 2024 20:56:44 GMT, Roger Riggs <rriggs at openjdk.org> wrote:
>> Markus KARG has updated the pull request incrementally with one additional commit since the last revision:
>>
>> inc should be faster than add on most CPUs
>
> src/java.base/share/classes/java/io/Reader.java line 212:
>
>> 210: default -> {
>> 211: for (int i = next, j = next + n; i < j;)
>> 212: cbuf[off++] = cs.charAt(i++);
>
> The single increment is fine and readable.
> Introducing a local variable for the end (j) seems unnecessary and its name is not indicative of its purpose as a limit.
Uhm... actually that is a quite common pattern we even teach people everyday, and in the past 30 years none of them had a problem understanding it... 🤔 Anyways, really I don't see any benefit in this whole discussion, as I said, I have no feelings about that tiny part of this PR at all. Simply post the exact code you want to have and I am fine to put it into place! 😃
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/21371#discussion_r1797420964
More information about the core-libs-dev
mailing list