On Thu, 22 Feb 2024 22:50:06 GMT, Andy Goryachev <ango...@openjdk.org> wrote:
>>> also, the first `+` is unnecessary >> >> I think it was done for uniformity with the other properties. I would use a >> `StringJoiner` these days for such a task anyway. > > StringJoiner seems to provide little benefit for maps or key=value pairs. Do > you know of an alternative? A `StringJoiner` seems suitable to me in this case: new StringJoiner(",", "PhongMaterial[", "]") .add("diffuseColor=" + getDiffuseColor()) .add("specularPower=" + getSpecularPower()) ... I guess you can make a helper method that takes a property and creates the string for you, like `diffuseColor.getName() + "=" + diffuseColor.getValue()` and then it won't look like a key-value pair in the joiner. You might want to search for the default implementation of records and see how they create the `name = value` representation. ------------- PR Review Comment: https://git.openjdk.org/jfx/pull/1378#discussion_r1500046959