RFR: 8291954: Use Optional.isEmpty instead of !Optional.isPresent in java.base

Andrey Turbanov aturbanov at openjdk.org
Fri Aug 5 07:02:42 UTC 2022


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 java.base

Changes: https://git.openjdk.org/jdk/pull/9697/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=9697&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8291954
  Stats: 23 lines in 6 files changed: 0 ins; 2 del; 21 mod
  Patch: https://git.openjdk.org/jdk/pull/9697.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/9697/head:pull/9697

PR: https://git.openjdk.org/jdk/pull/9697


More information about the core-libs-dev mailing list