我试图为结果返回一个布尔值.
public boolean status(List<String> myArray) {
boolean statusOk = false;
myArray.stream().forEach(item -> {
helpFunction(item).map ( x -> {
statusOk = x.status(); // x.status() returns a boolean
if (x.status()) {
return true;
}
return false;
});
});
}
Run Code Online (Sandbox Code Playgroud)
lambda表达式中使用的抱怨变量应该是final或者有效的final.如果我指定statusOk,那么我无法在循环内分配.如何使用stream()和map()返回布尔变量?
所以我试图找到最接近n的两个力量.例如10.5接近8比16.到目前为止,我知道如何为日志和ceil导入math*.我不知道该怎么办.