Today, Ali's IDEA Code specification plug-in

This problem was found during the inspection , It reminds me to try my best StringBuilder Instead of using “+” To connect strings , Below Baidu .
String messages = ""; for (ObjectError objectError : e.getBindingResult().
getAllErrors()) { messages += objectError.getDefaultMessage() + ","; }
// Will be translated into for (ObjectError objectError : e.getBindingResult().getAllErrors()) {
messages= new StringBuilder(messages).append(objectError.getDefaultMessage()).
toString(); }
<> It should be written like this
String messages = ""; StringBuilder stringBuilder= new StringBuilder(messages);
for (ObjectError objectError : e.getBindingResult().getAllErrors()) {
stringBuilder.append(objectError.getDefaultMessage()).append(","); } messages =
stringBuilder.toString();
The above optimized writing method , You can find that you don't need to generate new StringBuilder object , Improved performance .

Technology
©2019-2020 Toolsou All rights reserved,
elementui select obtain value Forbes China Auto rich list : He xiaopengdi 11 Li Xiangdi 14 Li Bindi 15 inherit jpa Repository Write custom method query Determine whether the current object is an array 4 Methods python Short circuit logic in SQL Server Database Glossary ( Essence )2020 year 6 month 26 day C# Class library model PageInput Output string at specified position --PTAvue-countTo Complete operation Ai Wei also talks about project management , On grass roots management