Two things. First, why is it better than:<p><pre><code>    String foo;
    
    if (parameter != null) {
        foo = ... ;
    }
    else {
        foo = defaultValue;
    }
</code></pre>
or even this, if you express all your transformations as a single expression:<p><pre><code>    String foo = parameter != null
        ? ...
        : defaultValue
</code></pre>
I don&#x27;t get it. Your way of doing seem awfully more verbose. Please note that
I&#x27;m not against Optional in general (although they are overplayed in my
opinion).<p>Second thing, I can&#x27;t shake off the feeling of inefficiency: building these
closures up, calling them. Lots of indirection for something that&#x27;s probably
very simple. I wouldn&#x27;t want to call this code in a hot loop. But then maybe
it&#x27;s not in a hot loop. Before you bring that up, the sufficiently smart (JIT)
compiler doesn&#x27;t exist. &quot;Sometimes suprisingly dumb&quot; is a better qualifier for
many compilers.<p>Note that I work with Java, and use the Java 8 features a lot. I just think this isn&#x27;t a really good example.