RFR: 8353795: Add Writer.of(StringBuilder)
Chen Liang
liach at openjdk.org
Sun May 4 14:51:44 UTC 2025
On Sat, 5 Apr 2025 17:36:29 GMT, Markus KARG <duke at openjdk.org> wrote:
> This Pull Requests proposes an implementation for [JDK-8353795](https://bugs.openjdk.org/browse/JDK-8353795): Adding the new method `public static Writer Writer.of(StringBuilder)`, providing a non-synchronized Writer implementation optimized for writing into `StringBuilder`.
>
> A basic test is provided to proof that the new `Writer` behaves as expected. For comparison, the same test is also run against `StringWriter`.
I will raise attention to this to other Oracle's JDK core library reviewers. Meanwhile you can start drafting a CSR like that for `getChars` for `CharSequence`.
One concern is that (See `HashMap.newHashMap` vs `HashMap.of`) `XxxWriter.of(StringBuilder)` now returns a basic `Writer` instead of `XxxWriter`, but since we already have that for `Reader.of` and the argument type is specific, I think this is not an issue.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/24469#issuecomment-2849260129
More information about the core-libs-dev
mailing list