On Thu, 18 Jun 2026 16:47:21 GMT, Andy Goryachev <[email protected]> wrote:
>> modules/javafx.graphics/src/main/java/javafx/scene/Node.java line 1371:
>>
>>> 1369: }
>>> 1370: }
>>> 1371: return buf.toString();
>>
>> If you prefer:
>> Suggestion:
>>
>> return switch (size()) {
>> case 0 -> "";
>> case 1 -> get(0);
>> default -> {
>> StringBuilder buf = new
>> StringBuilder();
>> for (int i = 0; i < size(); i++) {
>> buf.append(get(i));
>> if (i + 1 < size()) {
>> buf.append(' ');
>> }
>> }
>> yield buf.toString();
>> }
>> };
>
> or a regular switch(size()) to minimize the diff
Good idea, although I wonder if we should just straight up remove the
`toString()` from here and just put it into the `Node.toString()` method,
directly into the `StringBuilder` that is created there anyway.
-------------
PR Review Comment: https://git.openjdk.org/jfx/pull/2191#discussion_r3444395962