RFR - JDK-8203442 String::transform (Code Review)
Remi Forax
forax at univ-mlv.fr
Wed Sep 19 12:58:36 UTC 2018
Hi Jim,
the signature of transform() in the webrev was not updated (so the wildcards are missing).
And i'm still not convince this method should be introduced as is:
- it need more variants (transformToInt, transformToLong, transformToDouble) to be useful, currently "foo".transform(String::length) do box the resulting int to an Integer.
- pull it's own weight, while it's nice to be able to be able to write code fluently from left to right, "foo".transform(Utils::capitalizeFirstLetter), you can say exactly the same thing for all classes in the JDK, e.g. path.transform(Utils.appendTextSuffix). Other languages have introduced an operator to solve that issue (function call syntax is not fluent) like by example the operator '|>' as in "foo" |> Utils.capitalizeFirstLetter.
regards,
Rémi
----- Mail original -----
> De: "Jim Laskey" <james.laskey at oracle.com>
> À: "core-libs-dev" <core-libs-dev at openjdk.java.net>
> Envoyé: Mardi 18 Septembre 2018 19:52:17
> Objet: RFR - JDK-8203442 String::transform (Code Review)
> Please review the code for String::transform. The goal is to provide a String
> instance method to allow function application of custom transformations applied
> to an instance of String.
>
> webrev: http://cr.openjdk.java.net/~jlaskey/8203442/webrev/index.html
> jbs: https://bugs.openjdk.java.net/browse/JDK-8203442
> csr: https://bugs.openjdk.java.net/browse/JDK-8203703
>
> Cheers,
>
> — Jim
More information about the core-libs-dev
mailing list