我的代码中有一个问题,当我用Sonar分析它时,会显示此问题。
Remove this useless assignment; "listObj" already holds the assigned value along all execution paths.
我的代码:
for (int i = 0; i < blocks.getBlocks().size(); i++) {
if(StringUtils.stripAccents(blocks.getBlocks().get(i).getTitle().toLowerCase()).contains(search.toLowerCase())) {
listObj = this.inTitle(blocks, searcher, listObj , i);
}
}
return listObj;
问题出现在以下行:listObj = this.inTitle(blocks, searcher, listObj , i);
该问题消失后我该怎么办?