- orElseThrow: if personService.getAll() returns an Optional, then:
return personService.getAll().map(converter::toResource).orElseThrow(
() -> new NoResourceFound(...)
); - orElse: if personService.getByLastName() returns an optional:
return personService.getByLastName(lName).orElse(null);
Start building with Gemini 2.5 Pro.
1 day ago