title: Return value from Optional
body: <p>How to return a <code>String</code> value from an <code>Optional&lt;String&gt;</code> using <code>ifPresent</code> and avoiding <code>NullPointerException</code>?</p>
  
  <p>Example:</p>
  
  <pre><code>public String longestName() {
      Optional&lt;String&gt; longName = someList.stream().reduce((name1, name2) -&gt; name1.length() &gt; name2.length() ? name1 : name2);
  
      // If I do not want to use following
      // return longName.isPresent() ? longName.get() : "not present";
  
      // Can I achieve this using longName.ifPresent or longName.orElse("not present");
  }
  </code></pre>