On Wed, 30 Sep 2026 11:48:01 GMT, Alan Bateman <[email protected]> wrote:
>> Tagir F. Valeev has updated the pull request incrementally with one >> additional commit since the last revision: >> >> 8391789: Empty input test fixed > > src/java.base/share/classes/java/text/ListFormat.java line 420: > >> 418: return Collectors.collectingAndThen( >> 419: Collectors.mapping(String::valueOf, >> Collectors.toList()), >> 420: input -> input.isEmpty() ? "" : format(input)); > > If this proposal goes ahead then I assume the prototype implementation will > be replaced. It looks like the most efficient way would be for the > accumulator to accumulate in a StringBuilder for the "middle elements", with > the finishing handling the 0, 1, 2, 3 and > 3 cases. I agree with Alan here. IIRC ListFormat is specified to be immutable, so it should be possible to create a Collector implementation that creates a lot less intermediate objects. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/32716#discussion_r4144506622
