RFR: 8347027: String replaceAll with Function<String, String>

Markus KARG markus at headcrashing.eu
Wed May 21 10:41:42 UTC 2025


What is the benefit over the existing replacement methods? Is it easier 
to use, uses less resources, runs quicker...?

Am 20.05.2025 um 19:04 schrieb kieran-farrell:
> New API to the String.java class - replaceAllMapped(String, Function<MatchResult, String>) that allows regex based replacement via a user defined function allowing dynamic replacemnt based on the match. It delegates to the already existing Pattern.matcher().replaceAll(Function).
>
> -------------
>
> Commit messages:
>   - whitespace
>   - updates
>   - replaceAllMapped and test
>
> Changes: https://git.openjdk.org/jdk/pull/25335/files
>    Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=25335&range=00
>    Issue: https://bugs.openjdk.org/browse/JDK-8347027
>    Stats: 61 lines in 3 files changed: 61 ins; 0 del; 0 mod
>    Patch: https://git.openjdk.org/jdk/pull/25335.diff
>    Fetch: git fetch https://git.openjdk.org/jdk.git pull/25335/head:pull/25335
>
> PR: https://git.openjdk.org/jdk/pull/25335


More information about the core-libs-dev mailing list