Integrated: 8274394: Use Optional.isEmpty instead of !Optional.isPresent in jdk.jlink

2021-09-28 Thread Andrey Turbanov
On Sun, 26 Sep 2021 13:58:35 GMT, Andrey Turbanov wrote: > I propose to replace usages of !Optional.isPresent() with Optional.isEmpty > method. > It's makes code a bit easier to read. > Noticing negation before long chain of method calls is hard. This pull request has now bee

Re: RFR: 8274394: Use Optional.isEmpty instead of !Optional.isPresent in jdk.jlink

2021-09-28 Thread Mandy Chung
On Sun, 26 Sep 2021 13:58:35 GMT, Andrey Turbanov wrote: > I propose to replace usages of !Optional.isPresent() with Optional.isEmpty > method. > It's makes code a bit easier to read. > Noticing negation before long chain of method calls is hard. LGTM - Marked

Re: RFR: 8274394: Use Optional.isEmpty instead of !Optional.isPresent in jdk.jlink

2021-09-28 Thread Alan Bateman
On Sun, 26 Sep 2021 13:58:35 GMT, Andrey Turbanov wrote: > I propose to replace usages of !Optional.isPresent() with Optional.isEmpty > method. > It's makes code a bit easier to read. > Noticing negation before long chain of method calls is hard. Looks okay, this code pre-dates

RFR: 8274394: Use Optional.isEmpty instead of !Optional.isPresent in jdk.jlink

2021-09-27 Thread Andrey Turbanov
I propose to replace usages of !Optional.isPresent() with Optional.isEmpty method. It's makes code a bit easier to read. Noticing negation before long chain of method calls is hard. - Commit messages: - [PATCH] Use Optional.isEmpty instead of !Optional.isPresent in jdk.jlink

Re: RFR: 8184693: (opt) add Optional.isEmpty

2018-04-18 Thread Roger Riggs
Re: RFR: 8184693: (opt) add Optional.isEmpty Hi Vivek, Thanks for the update. In the test files, please remove the unnecessary imports of List and the various Predicate types. In most cases it's not a problem to have unnecessary imports. I happened to notice in this case that they're left ov

Re: RFR: 8184693: (opt) add Optional.isEmpty

2018-04-18 Thread Stuart Marks
Theeyarath <vivek.theeyar...@oracle.com> Cc: core-libs-dev <core-libs-dev@openjdk.java.net>; Paul Sandoz <paul.san...@oracle.com> Subject: Re: RFR: 8184693: (opt) add Optional.isEmpty Hi Vivek, Thanks for the update. In the test files, please remove the unnecessar

RE: RFR: 8184693: (opt) add Optional.isEmpty

2018-04-17 Thread Vivek Theeyarath
-libs-dev@openjdk.java.net>; Paul Sandoz <paul.san...@oracle.com> Subject: Re: RFR: 8184693: (opt) add Optional.isEmpty Hi Vivek, Thanks for the update. In the test files, please remove the unnecessary imports of List and the various Predicate types. In most cases it's not a problem to have unne

Re: RFR: 8184693: (opt) add Optional.isEmpty

2018-04-17 Thread Stuart Marks
: Stuart Marks Sent: Tuesday, April 17, 2018 5:11 AM To: Vivek Theeyarath <vivek.theeyar...@oracle.com> Cc: core-libs-dev <core-libs-dev@openjdk.java.net>; Paul Sandoz <paul.san...@oracle.com> Subject: Re: RFR: 8184693: (opt) add Optional.isEmpty Hi Vivek, Please add "@since 11&qu

RE: RFR: 8184693: (opt) add Optional.isEmpty

2018-04-17 Thread Vivek Theeyarath
-libs-dev@openjdk.java.net>; Paul Sandoz <paul.san...@oracle.com> Subject: Re: RFR: 8184693: (opt) add Optional.isEmpty Hi Vivek, Please add "@since 11" tags to the doc comments of the four Optional*.isEmpty() methods. Regarding the tests, I don't think the various newly added tes

Re: RFR: 8184693: (opt) add Optional.isEmpty

2018-04-16 Thread Stuart Marks
; core-libs-dev <core-libs-dev@openjdk.java.net> Subject: Re: RFR: 8184693: (opt) add Optional.isEmpty On 15 Apr 2018, at 11:25, Vivek Theeyarath <vivek.theeyar...@oracle.com> wrote: Hi All, Please review http://cr.openjdk.java.net/~vtheeyarath/8184693/webrev.01/ This looks o

RE: RFR: 8184693: (opt) add Optional.isEmpty

2018-04-16 Thread Vivek Theeyarath
, 2018 6:48 PM To: Vivek Theeyarath <vivek.theeyar...@oracle.com> Cc: Remi Forax <fo...@univ-mlv.fr>; core-libs-dev <core-libs-dev@openjdk.java.net> Subject: Re: RFR: 8184693: (opt) add Optional.isEmpty > On 15 Apr 2018, at 11:25, Vivek Theeyarath <vivek.theeyar...@oracl

Re: RFR: 8184693: (opt) add Optional.isEmpty

2018-04-15 Thread Chris Hegarty
OptionalInt. -Chris. > Regards > Vivek > -Original Message- > From: Vivek Theeyarath > Sent: Saturday, April 14, 2018 6:24 PM > To: Remi Forax <fo...@univ-mlv.fr> > Cc: core-libs-dev <core-libs-dev@openjdk.java.net> > Subject: RE: RFR: 8184693: (

Re: RFR: 8184693: (opt) add Optional.isEmpty

2018-04-15 Thread forax
i Forax" <fo...@univ-mlv.fr>, "core-libs-dev" > <core-libs-dev@openjdk.java.net> > Envoyé: Dimanche 15 Avril 2018 12:25:09 > Objet: RE: RFR: 8184693: (opt) add Optional.isEmpty > Hi All, > Please review http://cr.openjdk.java.net/~vtheeyarath/818469

RE: RFR: 8184693: (opt) add Optional.isEmpty

2018-04-15 Thread Vivek Theeyarath
ect: RE: RFR: 8184693: (opt) add Optional.isEmpty I missed that Remi. Thanks for pointing it out. Will address those and get back. Regards Vivek -Original Message- From: Remi Forax [mailto:fo...@univ-mlv.fr] Sent: Saturday, April 14, 2018 2:58 PM To: Vivek Theeyarath <vivek.theeyar...

RE: RFR: 8184693: (opt) add Optional.isEmpty

2018-04-14 Thread Vivek Theeyarath
-libs-dev@openjdk.java.net> Subject: Re: RFR: 8184693: (opt) add Optional.isEmpty Hi Vivek, OptionalInt, OptionalLong and OptionalDouble should be changed too. Rémi - Mail original - > De: "Vivek Theeyarath" <vivek.theeyar...@oracle.com> > À: "core-libs-dev&quo

Re: RFR: 8184693: (opt) add Optional.isEmpty

2018-04-14 Thread Remi Forax
rath" <vivek.theeyar...@oracle.com> > À: "core-libs-dev" <core-libs-dev@openjdk.java.net> > Envoyé: Samedi 14 Avril 2018 08:22:50 > Objet: RFR: 8184693: (opt) add Optional.isEmpty > Hi All, > > Please review. > > Bug: https://bugs.openj

Re: RFR: 8184693: (opt) add Optional.isEmpty

2018-04-14 Thread Remi Forax
08:22:50 > Objet: RFR: 8184693: (opt) add Optional.isEmpty > Hi All, > > Please review. > > Bug: https://bugs.openjdk.java.net/browse/JDK-8184693 > > Webrev : http://cr.openjdk.java.net/~vtheeyarath/8184693/webrev.00/ > > > > The related jtreg test was run and the test passed . > > > > Regards > > Vivek

RFR: 8184693: (opt) add Optional.isEmpty

2018-04-14 Thread Vivek Theeyarath
Hi All, Please review. Bug: https://bugs.openjdk.java.net/browse/JDK-8184693 Webrev : http://cr.openjdk.java.net/~vtheeyarath/8184693/webrev.00/ The related jtreg test was run and the test passed . Regards Vivek

Re: Optional.isEmpty()

2017-04-24 Thread Roger Riggs
Hi, IMHO,boolean isEmpty() would be a good complement to the existing empty() method. $.02, Roger On 4/24/2017 1:15 PM, Anthony Vanelverdinghe wrote: Hi Peter I'd say no: it's merely the negation of an existing method, and given that the bar for adding methods to Optional is set very

Re: Optional.isEmpty()

2017-04-24 Thread Anthony Vanelverdinghe
Hi Peter I'd say no: it's merely the negation of an existing method, and given that the bar for adding methods to Optional is set very high (see e.g. [1] and [2]), I don't see how this one would meet it. Moreover, I don't see any issues with simply writing: return

Re: Optional.isEmpty()

2017-04-24 Thread Sander Mak
> On 22 Apr 2017, at 11:40, Peter Levart wrote: >return cf.findModule(target).isEmpty(); > > What do you think? Would this pull its weight? If I had a nickel for each time I started typing .isEm.., I'd have a respectable nickel collection. Big +1 from me. Sander

Re: Optional.isEmpty()

2017-04-24 Thread dalibor topic
On 24.04.2017 10:26, Andrew Dinn wrote: Ah, bike-shedding! Personally, I much prefer isAbsent() to isNotPresent(), presence and absence being a historically well-sanctioned English language pairing. [n.b. I'll grant that my preference for C18th literature over Comp Sci argot might have

Re: Optional.isEmpty()

2017-04-24 Thread Andrew Dinn
On 22/04/17 14:31, Jonathan Bluett-Duncan wrote: > Your reasoning has personally convinced me that a method like `isEmpty()` > would pull its weight. However, at the risk of bikeshedding, I think it > should be named differently, as `isEmpty()` immediately makes me think that > `findModule()`

Re: Optional.isEmpty()

2017-04-22 Thread Jonathan Bluett-Duncan
Hi Peter, Your reasoning has personally convinced me that a method like `isEmpty()` would pull its weight. However, at the risk of bikeshedding, I think it should be named differently, as `isEmpty()` immediately makes me think that `findModule()` returns a List, which I'd easily find confusing.

Optional.isEmpty()

2017-04-22 Thread Peter Levart
Hi, Seeing the following line in some JDK test that was up for review: return cf.findModule(target).orElse(null) == null; I immediately jumped to suggest it would look better if written as: return !cf.findModule(target).isPresent(); But then I leaned back and asked myself: "Would it