RFR: 8274394: Use Optional.isEmpty instead of !Optional.isPresent in jdk.jlink
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 Changes: https://git.openjdk.java.net/jdk/pull/5707/files Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=5707&range=00 Issue: https://bugs.openjdk.java.net/browse/JDK-8274394 Stats: 8 lines in 5 files changed: 0 ins; 0 del; 8 mod Patch: https://git.openjdk.java.net/jdk/pull/5707.diff Fetch: git fetch https://git.openjdk.java.net/jdk pull/5707/head:pull/5707 PR: https://git.openjdk.java.net/jdk/pull/5707
On Sun, 26 Sep 2021 13:58:35 GMT, Andrey Turbanov <github.com+741251+turbanoff@openjdk.org> 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 the isEmpty method. ------------- Marked as reviewed by alanb (Reviewer). PR: https://git.openjdk.java.net/jdk/pull/5707
On Sun, 26 Sep 2021 13:58:35 GMT, Andrey Turbanov <github.com+741251+turbanoff@openjdk.org> 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 as reviewed by mchung (Reviewer). PR: https://git.openjdk.java.net/jdk/pull/5707
On Sun, 26 Sep 2021 13:58:35 GMT, Andrey Turbanov <github.com+741251+turbanoff@openjdk.org> 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 been integrated. Changeset: 6f4cefbc Author: Andrey Turbanov <turbanoff@gmail.com> Committer: Mandy Chung <mchung@openjdk.org> URL: https://git.openjdk.java.net/jdk/commit/6f4cefbcbaad38dcacd4e047c6c232a0a7a2... Stats: 8 lines in 5 files changed: 0 ins; 0 del; 8 mod 8274394: Use Optional.isEmpty instead of !Optional.isPresent in jdk.jlink Reviewed-by: alanb, mchung ------------- PR: https://git.openjdk.java.net/jdk/pull/5707
participants (3)
-
Alan Bateman
-
Andrey Turbanov
-
Mandy Chung