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,
java Four functional interfaces ( a key , simple )os Simple use of module Browser kernel ( understand ) Some East 14 Pay change 16 salary , Sincerity or routine ?HashMap Explain in detail It's unexpected Python Cherry tree (turtle The gorgeous style of Library )html Writing about cherry trees , Writing about cherry trees