Home > Back-end >  The 2020-12-17: Java and go, how to efficient string concatenation?
The 2020-12-17: Java and go, how to efficient string concatenation?

Time:12-18

The 2020-12-17: Java and go, how to efficient string concatenation? # f greatly architects a daily topic

CodePudding user response:

Java USES StringBuffer

CodePudding user response:

Java: stringbuilder
Go: var bt bytes. The Buffer
To write a string of bt
Bt. WriteString (s1)
Bt. WriteString (s2)

CodePudding user response:

Java is the StringBuilder (StringBuilder than StringBuffer efficient because the StringBuilder is thread-safe, synchronization method does not do lock)
Go is strings. Builder (go before 1.10 is bytes. The Buffer, but after strings. The Builder with efficient, reference)

CodePudding user response:

Java use StringBuilder (not thread-safe), consider using StringBuffer threading issues
  • Related