Before Java 9, javac always generated StringBuilder calls for string
concatenation (or StringBuffer prior to Java 2). Using + is less verbose,
generates the same code, is more readable, and, when we do finally bump the
compile target, will generate better code.

Peter

On Sun, Dec 15, 2024, 7:13 AM Elliotte Rusty Harold <elh...@ibiblio.org>
wrote:

> Thanks. In that case I'm -1 on this since it is not available in Java
> 8, and even in Java 9 is only possible, not necessarily implemented.
>
> We can revisit in a few years if the JDK has moved on by then.
>
> On Sun, Dec 15, 2024 at 1:05 AM Peter Burka <pe...@quux.net> wrote:
> >
> > I presume this is referring to
> > https://openjdk.org/jeps/280  (JEP 280: Indify String Concatenation)
> which
> > was implemented in Java 9.
> >
> > On Sat, Dec 14, 2024, 6:26 PM Elliotte Rusty Harold <elh...@ibiblio.org>
> > wrote:
> >
> > > On Sat, Dec 14, 2024 at 3:08 PM Serw <serwserw...@gmail.com> wrote:
> > >
> > > > Would the community support using string concatenation over
> StringBuilder
> > > > for simple cases? Modern JDKs (8+) optimize string concatenation
> > > > efficiently, making it both concise and performant.
> > >
> > > Interesting. Do you have a reference for that?
> > >
> > > --
> > > Elliotte Rusty Harold
> > > elh...@ibiblio.org
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
> > > For additional commands, e-mail: dev-h...@commons.apache.org
> > >
> > >
>
>
>
> --
> Elliotte Rusty Harold
> elh...@ibiblio.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
> For additional commands, e-mail: dev-h...@commons.apache.org
>
>

Reply via email to