String Templates - Syntactic sugar or useful improvement?
summary
Java 21 adds string templates as a preview feature with an explicit SDR processor that calls toString and a built‑in fmt processor that uses printf-style formats; IntelliJ shows migration hints. Custom processors are possible — demos extract Optional values and one processor returns a List instead of a String. The presenter shows a working live-coding demo and a clear anti-pattern where a processor mutates and clears a passed List, proving processors can do harmful side effects.
AI-written summary · about
chapters (7)
- 0:00Introduction to Java strings
- 2:16Legacy string concatenation
- 4:35String templates overview
- 6:00Working with template syntax
- 9:20IDE integration and hints
- 10:52Standard template processors
- 12:17Custom processors and patterns
related talks
52mRobust and Flexible String Templates in Java
58mJava's New Powers Hero or Villain in Your Code?
59mExpression Templates: Past, Present, Future
51mRefactor Your Code to Java 20
57mBreaking Java Stereotypes: It's Not Your Dad's Language Anymore
47mThe SolutionFactory to Java's Problems
50mJava Next - From Amber to Loom, from Panama to Valhalla
50mTo Java 20 and Beyond
