Details
-
Improvement
-
Resolution: Invalid
-
Minor
-
None
-
5.1
-
None
-
N/A
-
N/A
-
Description
I’ve noticed that there’s StringBuffer used in most classes instead of StringBuilder. Is there any reason for that? StringBuffer is much slower than StringBuilder due to synchronization, it should be used only when shared between threads. See http://stackoverflow.com/questions/355089/stringbuilder-and-stringbuffer-in-java
Simply use StringBuilder unless you really are trying to share a buffer between threads. StringBuilder is the unsynchronized (less overhead = more efficient) younger brother of the original synchronized StringBuffer class.