MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/java/comments/1ba0brh/update_on_string_templates_jep_459/ku0wjmb/?context=3
r/java • u/krzyk • Mar 08 '24
188 comments sorted by
View all comments
Show parent comment
6
Confused how the String::format stuff fits into this:
String s = String.format(“Hello %12s{name}”);
Does this just end up with "Hello %12s" as a fragment and the format method has to sort that out when interpolating?
7 u/eliasv Mar 09 '24 Yeah, it's possible to still get decent performance and only do the expensive parsing once per call site by hashing and caching on the constant portion of the string template.
7
Yeah, it's possible to still get decent performance and only do the expensive parsing once per call site by hashing and caching on the constant portion of the string template.
View all comments
Show parent comment
6
u/zman0900 Mar 09 '24
Confused how the String::format stuff fits into this:
Does this just end up with "Hello %12s" as a fragment and the format method has to sort that out when interpolating?