'if' statement can be simplified SonarLint: Replace this if-then-else statement by a single return

Sonar常见问题及修改建议(201912):https://blog.csdn.net/libusi001/article/details/103717457

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

一、报错提示

'if' statement can be simplified 
SonarLint: Replace this if-then-else statement by a single return statement

二、源代码

 if (paperList != null && !paperList.isEmpty()) {
      return true;
   }
      return false;

三、更改方式

return paperList != null && !paperList.isEmpty();

有用请点赞,养成良好习惯!

疑问、交流、鼓励请留言!

发布了267 篇原创文章 · 获赞 145 · 访问量 6万+

猜你喜欢

转载自blog.csdn.net/libusi001/article/details/103808958