StringBuilder vs StringBuffer vs StringWriter
javaIn java programming, We often using these three class about string building. Then, what difference about them?
- StringBuffer and StringBuilder, They were used to dynamic building string, You could know its thread safe after reading source code of StringBuffer, and StringBuilder is not thread safe, so StringBuffer performance less than StringBuilder on a single thread. But on the multi-thread, StringBuffer would be safe.
- StringWrite also dynamic building string, It was implemented by StringBuffer