First tell me what is the best way to concatenate large number of String objects? Is it a + b?

Most Java developers know not to use a + b (+ operator) because of huge performance problems, they use StringBuffer instead. In fact I did some tests in the past which confirms this folklore. However some of you may not know there is new kid on the block - StringBuilder.

java.lang.StringBuilder is java.lang.StringBuffer's cousin (like java.util.HashMap is to java.util.Hashtable or java.util.HashSet is to java.util.Vector) but without the synchronization overhead. Unless you need to concatenate a String from multiple Threads, you are likely to get better performance with StringBuilder.