我怎样才能将这个包裹在 if-then-else 中的布尔文字简化为单个调用以符合 sonarqube。谢谢

How can I simplify this boolean literals wrapped into if-then-else into a single invocation to conform to sonarqube. Thanks

@Override
protected boolean willFlightBeChanged(AwbFlt awbFlt) {
    if (CargoMaxUtil.isHostCarrier(awbFlt.carrier()) && (!Str.equals(awbFlt.alloc, AwbFlt.ALLOC_UU)))
        return true;
    return false;
}

总的来说:

if (condition)
  return true;
return false;

完全相同:

return condition;

所以:

return CargoMaxUtil.isHostCarrier(awbFlt.carrier()) && (!Str.equals(awbFlt.alloc, AwbFlt.ALLOC_UU));