----- Original Message ----- > From: "Tagir F. Valeev" <[email protected]> > To: "core-libs-dev" <[email protected]>, [email protected] > Sent: Wednesday, September 9, 2026 2:39:09 PM > Subject: Re: RFR: 8391789: Collector for ListFormat
> On Tue, 8 Sep 2026 21:52:52 GMT, Naoto Sato <[email protected]> wrote: > >>> Three options were suggested about the new API: >>> - ListFormat.formatting() >>> - ListFormat.toCollector() >>> - Collectors.listFormatting(ListFormat) static method >>> I feel it should belong to ListFormat, but I'm open to discussions. >>> >>> For testing, I tested a couple of scenarios and a few corner cases (empty >>> stream, null element, parallel stream) in a simple non-parameterized JUnit >>> test. I believe that it's enough, given that the implementation is trivial, >>> and >>> ListFormat itself, as well as Stream API is already thoroughly tested by >>> other >>> tests. Tell me if you feel that some testing scenarios are missing, I'll >>> happily add them. >>> >>> --------- >>> - [x] I confirm that I make this contribution in accordance with the >>> [OpenJDK >>> Interim AI Policy](https://openjdk.org/legal/ai). >> >> Thanks for the PR, Tagir. >> >> I think of this functionality as "localized joining", so I would have had >> `Collectors.joining(listFormat)` but that is not possible I suppose, because >> it >> would conflict with the overload that takes `CharSequence`. Maybe >> `Collectors.joiningLocalized(listFormat)` static method? This would highly >> help >> discoverability of the functionality as @viktorklang-ora mentioned. > > @naotoj thank you for the review. > I can rewrite it to `joiningLocalized` and update CSR if @viktorklang-ora > agrees. > > I guess it would be better to move tests to CollectorsTest.java? The problem of having a method that stars with "joining" but is not "joining" is that the completion in an IDE for "joining()" is altered. Currently, when you starts to type "join" + completion, any IDE will complete to joining() and place the caret inside the parenthesis, but if we add "joiningLocalized", the completion will first ask for which joining before being able to complete. Given that the actual joining() overloads are used quite a lot, I think it's better to also rename "joiningLocalized" to just "joining(ListFormat)" and rely on overloading. regards, Rémi > > ------------- > > PR Comment: https://git.openjdk.org/jdk/pull/32716#issuecomment-5601925813
