On Fri, 11 Oct 2024 21:02:30 GMT, Markus KARG <d...@openjdk.org> wrote:

>> 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! 😃

I would say this current version is fine: that's how we handle encode/decode 
loop in classes like `String`.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/21371#discussion_r1797478583

Reply via email to