RFR: 8314147: Updated the PhongMaterial documentation [v3]
Andy Goryachev
angorya at openjdk.org
Thu Feb 22 23:16:59 UTC 2024
On Thu, 22 Feb 2024 23:04:50 GMT, Nir Lisker <nlisker at openjdk.org> wrote:
>> 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.
It looks like compiler auto-generates code for records.
The last solution is malloc galore: multiple StringBuilders, much worse than the original concatenation.
All right, sorry for discussion unrelated to this PR.
-------------
PR Review Comment: https://git.openjdk.org/jfx/pull/1378#discussion_r1500054617
More information about the openjfx-dev
mailing list