Java 8 流映射与参数
2022-09-03 08:29:39
我有这几个函数,我想知道是否可以将参数传递给deviceEvent.hasAlarm()
.map(this::sendSMS)
private void processAlarm (DeviceEvent deviceEvent) {
notificationsWithGuardians.stream()
.filter (notification -> notification.getLevels().contains(deviceEvent.getDeviceMessage().getLevel()))
.map(this::sendSMS)
.map(this::sendEmail);
}
private DeviceAlarmNotification sendSMS (DeviceAlarmNotification notification, DeviceEvent deviceEvent) {
if (deviceEvent.hasAlarm()) {
}
return notification;
}