IDEA告警详解:Optional.isPresent can be replaced with functional-style expression_java

类似 if(Optional.isPresent()) 的条件语句,可以被重写成函数式风格。

if (!response.isPresent()) {
return Result.success(null);

} else {
return Result.success(response.get());
}
response.map(Result::success)
.orElseGet(() -> Result.success(null));