title: Optional get value if present
body: <p>As an example I have an optional like this:</p>
  
  <pre><code>Optional&lt;Desktop&gt; opt = Optional.ofNullable(status).map(Status::getDesktop);
  </code></pre>
  
  <p>I want to have the desktop and work with it outside of lambda expressions. I do it like this:</p>
  
  <pre><code>if (opt.isPresent()){
      Desktop desktop = opt.get();
      ...
  }
  </code></pre>
  
  <p>Is there a better solution to get the desktop; something like this ?</p>
  
  <pre><code>Desktop desktop = Optional.ofNullable(status).map(Status::getDesktop).ifPresent(get());
  </code></pre>
  
  <p>EDIT: OrElse was the method I was looking for :)</p>