title: Java Optional return value only if present
body: <p>Is it possible to return the Optional value from method only if it's present, but if it's not just continue with a normal method flow. Something like this:</p>
  
  <pre><code>public Message processMessage(Message message) {
          // ErrorMessage is subclass of Message; only returned if validator found some violations, otherwise empty optional
          Optional&lt;ErrorMessage&gt; error = validator.validate(message);
  
          if (error.isPresent()) return error.get();
  
          // returns different possible subclasses of Message
          return service.processMessage(message);
      }
  </code></pre>
  
  <p>Is there any prettier way to write this?</p>