+ 1
What is the data structure of string builder in java ?
for string its a string pool and for StringBuffer its buffer and for StringBuilder ?
1 Resposta
+ 1
StringBuilder is just a just an object.
It is best used when concatenating lots of Strings. (Or in other words: Building lots of Strings).
It works similar to an ArrayList, but optimized for Strings.
I recommend it for large toStrings() where a loop is involved. It will heavily improve performance there.
Or of course anywhere else with a fair amount of concatenation.