- 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);
Monday, May 20, 2019
Java Optional - Good Practice
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment