, () Optional, , ( ) . .
caseOptional.flatMap(theCase -> userOptional
.map(user -> new AbstractMap.SimpleEntry<>(theCase, user)))
.ifPresent(e -> e.getKey().getProcess().setDesigner(e.getValue()));
AbstractMap.SimpleEntry stand-in .
:
caseOptional.flatMap(theCase -> userOptional
.map(user -> Collections.singletonMap(theCase, user)))
.ifPresent(m -> m.forEach((c, u) -> c.getProcess().setDesigner(u)));
caseOptional.map(PatientCase::getProcess)
.ifPresent(p -> userOptional.ifPresent(p::setDesigner));
caseOptional.ifPresent(c -> userOptional.ifPresent(u -> c.getProcess().setDesigner(u)));
.