This question basically asks for an alternative to concatenating strings directly in a loop. I couldn't find a duplicate quickly, but I'm sure that this is a standard beginner problem having been asked some thousand times maybe.
The title "how to optimize java-performance?" is not helpful for search, and I guess the situation with other equivalent questions is the same. That's why it gets asked again and again.
I refused to answer it, in order not to spam SO with useless repetitive stuff, but there are already 5 answers, not all of them helpful. I'd like to see such questions go away and have a canonical question mentioning string concatenation in the title, but it's not going to happen as beginners have no idea what part of the code is the culprit.
My questions:
- Should such questions be answered?
- Can we get a canonical question for this problem? (maybe edit the title?)