作者热门文章
- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我需要转换以下方法 java 8 内联函数。需要一些专家的帮助和解释才能做到这一点。
@Override
public boolean a(final Collection<DoseDetailMutableDTO> detailModels) {
for (DoseDetailMutableDTO dd : detailModels) {
final boolean doseDetailTextScheduled = isDoseDetailTextScheduled(dd, 1);
if (doseDetailTextScheduled) {
return true;
}
}
return false;
}
还有做这个 intelj IDE 有什么捷径吗?
最佳答案
您可以使用 Stream.anyMatch
作为:
public boolean a(final Collection<DoseDetailMutableDTO> detailModels) {
return detailModels.stream()
.anyMatch(dd -> isDoseDetailTextScheduled(dd, 1));
}
returns
true
if any elements of the stream match the provided predicate, otherwisefalse
编辑:(来自评论)
The control to learn for such suggested shortcuts on IntelliJ IDEA is
Ctrl+Space
or on MacOS can useAlt+Enter
as well.
关于java - 如何将以下方法转换为 Java 8 内联函数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53879623/
我是一名优秀的程序员,十分优秀!