Understanding Optionals.orElse
<p>I am trying to learn <strong>Java 8 feature Optional</strong>. I am confused about how Optional.orElse is working. Here is what i have tried:</p>

<pre><code>public class OptionalsExample {

    public static void main(String[] args) {
        Name userName = new Name();
        userName.setName("John Doe");
        Optional&lt;Name&gt; optionalName = Optional.ofNullable(userName);
        optionalName.ifPresent(
                (Name value) -&gt; {
                    Optional&lt;String&gt; optionalNameString = Optional.ofNullable(value.getName());
                    optionalNameString.ifPresent(name -&gt; System.err.println("Name is: " + optionalNameString.get()));
                }
        );
    }
    private static void printError() {
        System.err.println("No Name present");
    }
}
</code></pre>

<p>My Concern is that if name is set everything works fine but when no name is set i want to execute <strong>orElse</strong>. 
I want to do something when i comment</p>

<pre><code>userName.setName("John Doe");
</code></pre>

<p>like printing No Name Found</p>

<p>How can i do that?</p>

<p>TIA</p>