On Fri, 11 Oct 2024 22:45:55 GMT, Chen Liang <[email protected]> wrote:
>> 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! 😃
>
> I would say this current version is fine: that's how we handle encode/decode
> loop in classes like `String`.
I agree with Roger - the previous version you had:
for (int i = 0; i < n; i++)
cbuf[off + i] = cs.charAt(next + i);
was trivial, easy to understand immediately without having to stare at it for a
while to see what's being done there, compared to the current version:
for (int i = next, j = next + n; i < j;)
cbuf[off++] = cs.charAt(i++);
I prefer switching to the former version.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/21371#discussion_r1797619050