RFR: 8341566: Add Reader.of(CharSequence) [v10]

Markus KARG duke at openjdk.org
Sat Oct 12 07:47:56 UTC 2024


On Sat, 12 Oct 2024 06:57:40 GMT, Jaikiran Pai <jpai at openjdk.org> wrote:

>> 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.

switched to previous version to end discussion

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

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


More information about the core-libs-dev mailing list