You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by GitBox <gi...@apache.org> on 2020/04/05 14:34:09 UTC

[GitHub] [netbeans] jtulach commented on issue #2063: Lookup, add optinal support

jtulach commented on issue #2063: Lookup, add optinal support
URL: https://github.com/apache/netbeans/pull/2063#issuecomment-609425745
 
 
   Hello Hector, thanks for your interest in extending `Lookup` API. It is a core NetBeans API and I am still fond of creating it. That's one aspect.
   
   The other one is that I don't understand why Java has `Optional`!? I believe I am not the only one. Java community seems to be divided into `Optional` believers and haters. I guess I fall rather into the latter category. To make it short, I have nothing against the believers using:
   ```java
   Optional.of(context.lookup(AClass.class)).orElse(...)
   ```
   but adding new method into `Lookup` and writing:
   ```java
   context.lookupOptional(AClass.class).orElse(...)
   ```
   isn't my cup of tea. Adding a new method into subclassable class isn't for free. Moreover please notice that both variants of the code are actually almost of the same length - e.g. I don't see any benefits in adding new `lookupOptional` method into `Lookup`.
   
   That said, I am not going to veto the change, if there are at least three supporters of `Optional` in the `Lookup`. E.g. I am going to continue with the review, assuming you'll find enough supporters to overcome my own dislike of `Optional`.
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists