在项目中使用StringBuffer进行字符串拼接时,有如下提示:
String concatenation as argument to 'StringBuffer.append()' call less... (Ctrl+F1)
Inspection info: Reports String concatenation used as the argument to StringBuffer.append(), StringBuilder.append() or Appendable.append(). Such calls may profitably be turned into chained append calls on the existing StringBuffer/Builder/Appendable, saving the cost of an extra StringBuffer/Builder allocation.
This inspection ignores compile time evaluated String concatenations, which when converted to chained append calls would only worsen performance.
在使用append进行拼接时,不要在拼接的字符串中再使用+号进行拼接。