SyntaxFix
Write A Post
Hire A Developer
Questions
With Java 8 Optional it can be done with:
Optional
Optional<Obj> obj = dao.find(); obj.map(obj.setAvailable(true)).orElseGet(() -> { logger.fatal("Object not available"); return null; });