Optional is like a generic NullObject. What should e.g. Map#get return, if not Optional?
It's NullObjects all the way down. Makes more sense when designs favor compositions over inheritance.
Optional is the wrapper no one needed. For syntactic sugar, static library methods worked just fine.
class Widget {...}
class final NullWidget extends Widget {
static NULL_WIDGET = new NullWidget();
...
}
class WidgetMap extends HashMap<String,Widget> {
Widget get( String key ) {
if( contains( key )) { return super.get( key ); }
return NULL_WIDGET;
}
...
}