NOTE

StringBuilder

Efficient mutable text construction, capacity, non-thread-safety, and compiler concatenation optimizations.

JavaCreated Updated 1 min readhistorical

This is a historical learning note and may contain outdated or incomplete understanding.

StringBuilder is a mutable, non-thread-safe text builder intended for efficient incremental construction.

It keeps expandable internal storage; exact growth rules are implementation details. Supplying an estimated capacity can reduce reallocations for large known outputs.

Use it for loops or complex incremental concatenation. Simple a + b + c expressions are often compiled efficiently already, so manually rewriting every concatenation is unnecessary.

Loading helpful count