Comment on Deprecating: java.util.Optional.get()?parentComments−specialist10yReally? 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; } ... }−lmm10yUrgh. Sure that's one option, but I don't want to have to subclass HashMap every time I want to store something different in it. Also sometimes I want generic code that uses a map.−cytzol10yAnd sometimes you want a different type of map...
Comments
Really?
Urgh. Sure that's one option, but I don't want to have to subclass HashMap every time I want to store something different in it. Also sometimes I want generic code that uses a map.
And sometimes you want a different type of map...